package com.dhcc.DRGsHosp.facade.impl;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import javax.inject.Inject;
import javax.inject.Named;
import org.springframework.beans.factory.annotation.Autowired;
import com.dhcc.DRGsHosp.application.AnalysisDRGsReportApplication;
import com.dhcc.DRGsHosp.facade.AnalysisDRGsReportFacade;
import com.dhcc.DRGsHosp.facade.DrgsIndexCalFacade;
import com.dhcc.DRGsHosp.infra.util.Arith;
import com.dhcc.DRGsHosp.infra.util.CustomXWPFDocument;
import com.dhcc.DRGsHosp.infra.util.DrgsIndex;
import com.dhcc.DRGsHosp.infra.util.WordUtil;

/**
 * 
  * @Description:简版新版分析报告导出-POI技术
  * @Author:ShaoZhiYuan
  * @Date:2017年2月14日 下午2:25:40 
  * @version :2.3.2
  * @copyright:DHC 2015-2016
 */
@Named("drgsHospFacadeImplszy1107")
public class AnalysisDRGsReportFacadeImpl implements AnalysisDRGsReportFacade  {

	@Autowired
	private  AnalysisDRGsReportApplication analysisDRGsReportApplication;
	@Inject
	private DrgsIndexCalFacade drgsIndexCalFacade;
	
	//存放全部信息的map
	private static Map<String,Object> params= new HashMap<String,Object>();
	//存放图片信息的map
	private static Map<String,Object> allMap= new HashMap<String,Object>();
	
	private static String picRootio;
	private static String wordRootio;
	private static String writeRootio;
	
	private static String specCodeQuFen;
	private static  long start ;
	private static  long reportNo;
	private static String hospType;
	
	private String errMsg="";
	
	private static List<List<String>> resultListOne=new ArrayList<List<String>>(); //保持2.3表格信息
	private static List<List<String>> resultListTwo=new ArrayList<List<String>>(); //保持2.4表格信息
	private static List<List<String>> resultListThree=new ArrayList<List<String>>(); //保持表格7信息
	private static List<List<String>> resultListFour=new ArrayList<List<String>>(); //保持表格11信息
	private static List<List<String>> resultListFive=new ArrayList<List<String>>(); //保持表格12信息
	private static List<List<String>> resultListSix=new ArrayList<List<String>>(); //保持表格13信息
	private static List<List<String>> resultListSeven=new ArrayList<List<String>>(); //保持表格14信息
	private static List<List<String>> resultListEight=new ArrayList<List<String>>(); //保持表格15信息
	private static List<List<String>> resultListNine=new ArrayList<List<String>>(); //保持表格16信息
	private static List<List<String>> resultListTen=new ArrayList<List<String>>(); //保持表格17信息
	private static List<List<String>> resultListEleven=new ArrayList<List<String>>(); //保持表格18信息
	private static List<List<String>> resultListTwelve=new ArrayList<List<String>>(); //保持表格20信息
	private static List<List<String>> resultListThirteen=new ArrayList<List<String>>(); //保持表格21信息
	private static List<List<String>> resultListFourteen=new ArrayList<List<String>>(); //保持表格22信息
	private static List<List<String>> resultListSixteen=new ArrayList<List<String>>(); //保持表格23信息
	private static List<List<String>> resultListSeventeen=new ArrayList<List<String>>(); //保持表格25信息
	private static List<List<String>> resultListEightteen=new ArrayList<List<String>>(); //保持表格26信息
	private static List<List<String>> resultListNineteen=new ArrayList<List<String>>(); //保持表格27信息
	private static List<List<String>> resultListTwenty=new ArrayList<List<String>>(); //保持表格19信息
	private static List<List<String>> resultListTwentyOne=new ArrayList<List<String>>(); //保持表格24信息
	private static List<List<String>> resultListTwentyTwo=new ArrayList<List<String>>(); //保持表格9信息
	
	private static List<List<String>> resultListFBOne=new ArrayList<List<String>>(); //保持附表1信息
	private static List<List<String>> resultListFBTwo=new ArrayList<List<String>>(); //保持附表2信息
	private static List<List<String>> resultListFBThree=new ArrayList<List<String>>(); //保持附表3信息
	private static List<List<String>> resultListFBFour=new ArrayList<List<String>>(); //保持附表4信息
	private static List<List<String>> resultListFBFive=new ArrayList<List<String>>(); //保持附表5信息
	
	//病组和病例复杂程度用list
	private static List<String> drgsCaseARListA=new ArrayList<>();
	private static List<String> drgsCaseARListB=new ArrayList<>();
	private static List<String> drgsCaseARListC=new ArrayList<>();
	private static List<String> drgsCaseARListD=new ArrayList<>();
	private static List<String> drgsCaseARListE=new ArrayList<>();
	/**
	 * 
	  * @Description: 获取当前系统中可用标杆 
	  * @return
	 */
	@Override
	public List<Map<String,Object>> getARBenchmarkYear() {
		return analysisDRGsReportApplication.getARBenchmarkYear();
	}
	/**
	 * 获取当前系统库中所有的临床专业
	 * @return
	 */
	@Override
	public List<Map<String, Object>> getARBenchSpecCode() {
		String groupScheme=drgsIndexCalFacade.getGroupScheme();    //获取分组方案
		//根据分组方案获取分组器版本号
		String drgVersion = analysisDRGsReportApplication.getDRGversionCode(groupScheme);
		return analysisDRGsReportApplication.getARBenchSpecCode(drgVersion);
	}
	
	/**  
	 * @Description: 获取系统中的分组器版本号
	 * @author shaozhiyuan 
	 * @date 2018年5月2日  
	 * @version V3.1.0  
	 */  
	@Override
	public List<Map<String, Object>> getARDrgVersion() {
		// TODO Auto-generated method stub
		return analysisDRGsReportApplication.getARDrgVersion();
	}
	/**
	 * 
	 * TODO 主方法
	 * 
	 * @author ShaoZhiYuan  
	 * @see com.dhcc.DRGsHosp.facade.AnalysisDRGsReportFacade#createDRGsReport(java.util.Map)
	 */
	@Override
	public Map<String, Object> findARDRGsReport(Map<String, Object> dto) {
		
		start = System.currentTimeMillis(); //生成文档开始时间
		allMap=new HashMap<>();
		Map<String,Object> paramMap= new HashMap<String,Object>();
		
		//存放分析报告图片位置地址
		picRootio=dto.get("picRoot")+"";
		//存放分析报告文档位置地址
		wordRootio=dto.get("wordRoot")+"";
		//存放生成的分析报告文档位置地址
		writeRootio=dto.get("writeRoot")+"";
		
		String dateFrom=dto.get("dateFrom")==null?"":dto.get("dateFrom").toString();  //起始日期
		String dateTo=dto.get("dateTo")==null?"":dto.get("dateTo").toString();        //终止日期
		String hospCode=dto.get("hospCode")==null?"":dto.get("hospCode").toString();  //院区选择
		String stdId=drgsIndexCalFacade.getStdID(dateFrom,dateTo);   //获取标杆定位id
		if(stdId==null){
			 allMap.put("errorMessageData" ,"您没有进行条件配置，请在右上角进行配置");
			 return allMap;
		}
		String groupScheme=drgsIndexCalFacade.getGroupScheme();    //获取分组方案
		dateFrom=DrgsIndex.formateDateFrom(dateFrom);          //规范日期格式
		dateTo=DrgsIndex.formateDateTo(dateTo);
		
		specCodeQuFen=dto.get("isInmedical")==null?"1":dto.get("isInmedical").toString()+""; //重点专业内外科区分
		hospType=dto.get("hospType")==null?"综合医院":dto.get("hospType").toString()+""; //医院类型
		
		String isComplete=(dto.get("isComplete")==null?"":dto.get("isComplete").toString()); //是否进行数据完整性校验
		String isRefine=dto.get("isRefine")==null?"1":dto.get("isRefine").toString()+"";  //是否精细化 1是0否
		
		//获取重点专业
		String specCode=dto.get("specCode")==null?"--":dto.get("specCode").toString().trim();
		
		//根据分组方案获取分组器版本号
		String drgVersion = analysisDRGsReportApplication.getDRGversionCode(groupScheme);
		
		//装填重要信息
		paramMap.put("dateFrom", dateFrom);
		paramMap.put("dateTo", dateTo);
		paramMap.put("drgVersion", drgVersion);
		paramMap.put("stdId", stdId);
		paramMap.put("groupScheme", groupScheme);
		paramMap.put("hospCode", hospCode);
		paramMap.put("isRefine", isRefine);
		paramMap.put("specCode", specCode); 
		
		   //判断有没有数据
				int dataIsNull=analysisDRGsReportApplication.findARDataIsNull(dateFrom, dateTo,groupScheme,hospCode);
				
				if(dataIsNull!=0){
					List<Map<String,Object>> drgsList = analysisDRGsReportApplication.findARNewDrgs(dateFrom, dateTo, stdId ,groupScheme,hospCode);
					
					if (!drgsList.isEmpty()) {
						Map<String, Object> nmap = new HashMap<String, Object>();
						nmap.put("newdrgs", 1);
						nmap.put("drgsList", drgsList);
						return nmap;
					} else {
						//数据完整性校验
						List<Map<String,Object>> checkedList = analysisDRGsReportApplication.findARCheckedData(dateFrom, dateTo, stdId ,groupScheme,hospCode);
						Map<String,Object> objch=checkedList.get(0);
						double operlevelRatio=objch.get("FIRST_JUDGE_VALUE")==null?0:Double.valueOf(objch.get("FIRST_JUDGE_VALUE").toString());
						double opercodeRatio=objch.get("TWO_JUDGE_VALUE")==null?0:Double.valueOf(objch.get("TWO_JUDGE_VALUE").toString());
						double opertypeRatio=objch.get("THREE_JUDGE_VALUE")==null?0:Double.valueOf(objch.get("THREE_JUDGE_VALUE").toString());
						double ditypeRatio=objch.get("FOUR_JUDGE_VALUE")==null?0:Double.valueOf(objch.get("FOUR_JUDGE_VALUE").toString());
						double dicodeRatio=objch.get("FIVE_JUDGE_VALUE")==null?0:Double.valueOf(objch.get("FIVE_JUDGE_VALUE").toString());
					
					  if (isComplete.trim().equals("1")&&(operlevelRatio <0.85 ||opercodeRatio<0.85|| opertypeRatio<0.85||ditypeRatio<0.85||dicodeRatio<0.85)) {
						  allMap.put("errorMessageData" ,"请检测您导入的数据中手术编码、手术级别、手术类型、诊断编码、诊断类型是否符合数据规范！");
						  return allMap;
						}else {
							//进行主要手术的手术操作判断
							String caseOperCount = analysisDRGsReportApplication.findHospCaseOperationCount(paramMap);
							if(Double.valueOf(caseOperCount).intValue()>=1){
							}else{
								//查看系统配置表中手术编码版本
								String hospCaseOperationVersion = analysisDRGsReportApplication.findHospCaseOperationVersion(paramMap);
								if(hospCaseOperationVersion==null){
									allMap.put("errorMessageData" ,"需在系统配置功能中做手术编码版本配置");
									return allMap;
								}else{
									paramMap.put("operVersion", hospCaseOperationVersion+"");
									//查看系统配置表中手术编码版本
									String hospCaseOperVersionCnt = analysisDRGsReportApplication.findHospCaseOperVersionCnt(paramMap);
									if(Double.valueOf(hospCaseOperVersionCnt).intValue()>=1){
										//更新手术操作字段
										 analysisDRGsReportApplication.updateHospCaseOper(paramMap);
									}else{
										allMap.put("errorMessageData" ,"您选取的手术编码版本在字典表没有区分手术操作数据，请重新选择");
										return allMap;
									}
								}
							}
							caseOperCount = analysisDRGsReportApplication.findHospCaseOperationCount(paramMap);
							if(Double.valueOf(caseOperCount).intValue()>=1){
							}else{
								allMap.put("errorMessageData" ,"手术操作字段仍未区分，请重新操作");
								return allMap;
							}
							
							//医院基础信息单独处理,方便下面的做分母调用，不然报空指针异常的bug
							loadARHospDataSection(dto, paramMap);
							//多线程处理
							ExecutorService indexPool = Executors.newFixedThreadPool(7);
							indexPool.execute(new TestRunnableA(dto, paramMap)); 
							indexPool.execute(new TestRunnableB(dto, paramMap)); 
							indexPool.execute(new TestRunnableC(dto, paramMap)); 
							indexPool.execute(new TestRunnableD(dto, paramMap)); 
							indexPool.execute(new TestRunnableE(dto, paramMap)); 
							indexPool.execute(new TestRunnableF(dto, paramMap)); 
							indexPool.execute(new TestRunnableG(dto, paramMap)); 
							//关闭线程池
							indexPool.shutdown();
							//线程池里所有线程走完
							 while(true){
						           if(indexPool.isTerminated()){
						                System.out.println("所有的子线程都结束了！");  
						                break;  
						            }  
						       }
							  return allMap;
							
						}
						
					}
				}else{
					 allMap.put("errorMessageData" ,"您选择的时间段内无数据, 生成文档失败");
					 return allMap;
				}
	}
	//医院基础信息单独处理,方便计算做分母调用
	public void loadARHospDataSection(Map<String, Object> dto, Map<String, Object> paramMap){
		// 获取出院病历术，大于60.入组数， 入组率
		List<Map<String,Object>> hospBaseQuotaStOne = analysisDRGsReportApplication.findARSimpHospBaseQuota(paramMap);
		Map<String,Object> hospBaseQuotaStOneMap=hospBaseQuotaStOne.get(0);
		params.put("hospoutcasecnt", hospBaseQuotaStOneMap.get("ALLCNT") == null ? "0": Arith.dataFormat(hospBaseQuotaStOneMap.get("ALLCNT").toString(), "2"));// 出院病例数
		params.put("hospoutcasecnt_temp", hospBaseQuotaStOneMap.get("ALLCNT") == null ? "0": Integer.parseInt(hospBaseQuotaStOneMap.get("ALLCNT")+""));// 出院病例数 (未格式化)
		params.put("ingpcacnt",hospBaseQuotaStOneMap.get("INGROUP") == null ? "0" : Arith.dataFormat(hospBaseQuotaStOneMap.get("INGROUP").toString(), "2"));// 入组数
		params.put("ingroupcasecnt_temp",hospBaseQuotaStOneMap.get("INGROUP") == null ? "0" : hospBaseQuotaStOneMap.get("INGROUP").toString());// 入组数 (未格式化)
		params.put("oversixtycasecnt", hospBaseQuotaStOneMap.get("OVERSIXTY") == null ? "0" :Arith.dataFormat(hospBaseQuotaStOneMap.get("OVERSIXTY").toString(), "2"));// 大于60
		params.put("oversixtycasecnt_temp", hospBaseQuotaStOneMap.get("OVERSIXTY") == null ? "0" : hospBaseQuotaStOneMap.get("OVERSIXTY").toString());// 大于60 (未格式化)
		params.put("ingroupRatio", (hospBaseQuotaStOneMap.get("GROUPRATIO") == null ? 0 : hospBaseQuotaStOneMap.get("GROUPRATIO"))+"%");// 入组率
		params.put("notingrocasecnt", hospBaseQuotaStOneMap.get("NOTINGROUP") == null ? "0": Arith.dataFormat(hospBaseQuotaStOneMap.get("NOTINGROUP").toString(), "2"));// 未入组
		params.put("notingrocasecnt_temp", hospBaseQuotaStOneMap.get("NOTINGROUP") == null ? "0": hospBaseQuotaStOneMap.get("NOTINGROUP").toString().trim());// 未入组 (未格式化)
	
	
	}
	//加载第一个章节信息
	public void loadARFirstSection(Map<String, Object> dto, Map<String, Object> paramMap){

		InputStream propInputStream=null;
		// 获取医院名称
	    String hospName=dto.get("hospName")==null?"--":dto.get("hospName").toString().trim();
		if(hospName.endsWith("医院")){
			hospName=hospName.substring(0, hospName.length()-2);
		}
		params.put("hospName", hospName);
		
		Calendar cal = Calendar.getInstance();// 使用日历类
		String year = cal.get(Calendar.YEAR) + "";// 得到年
		String month = (cal.get(Calendar.MONTH) + 1) + "";// 得到月，因为从0开始的，所以要加1
		params.put("createYear", year);
		params.put("createMonth", month);
		
		String hospLevel=dto.get("hospLevel")==null?"--":dto.get("hospLevel").toString().trim();  //医院级别
		String hospBuildYear=dto.get("hospBuildYear")==null?"--":dto.get("hospBuildYear").toString(); //创建年份
		String hospBedNum=dto.get("hospBedNum")==null?"--":Arith.dataFormat(dto.get("hospBedNum").toString(), "2");  //核定床位数
		String hospBedNum_temp=dto.get("hospBedNum")==null?"0":dto.get("hospBedNum").toString();  //核定床位数(计算)
		String hospRealBedNum=dto.get("hospRealBedNum")==null?"--":Arith.dataFormat(dto.get("hospRealBedNum").toString(), "2");  //实际床位数
		String hospCaseNum=dto.get("hospCaseNum")==null?"--":Arith.dataFormat(dto.get("hospCaseNum").toString(), "2"); //年门急诊量
		String hospDocNum=dto.get("hospDocNum")==null?"--":Arith.dataFormat(dto.get("hospDocNum").toString(), "2");    //医师数量
		String hospBedDaysNum=dto.get("hospBedDaysNum")==null?"--":dto.get("hospBedDaysNum").toString();  //开放总床日数
		
		params.put("hospBuildYear", hospBuildYear);
		params.put("hospLevel", hospLevel);
		params.put("hospBedNum", hospBedNum);
		params.put("hospRealBedNum", hospRealBedNum);
		params.put("hospCaseNum", hospCaseNum);
		params.put("hospDocNum", hospDocNum);
		params.put("hospBedDaysNum", hospBedDaysNum);
		
		// 获取科室数量
		int hospDepCnt = analysisDRGsReportApplication.findARDepCount();
		params.put("hospDepCnt", hospDepCnt);	
		
		//加载年份信息
		String dateFrom=dto.get("dateFrom")==null?"":dto.get("dateFrom").toString();  //起始日期
		String dateTo=dto.get("dateTo")==null?"":dto.get("dateTo").toString();        //终止日期
		String analysisyear = dateFrom.substring(0, 4);// 分析的年份
		String analysisdateTo = dateTo.substring(0, 4);// 分析的年份
		String analysismonthfrom=dateFrom.substring(5, 7); //分析开始的月份
		String analysismonthto=dateTo.substring(5, 7); //分析结束的月份
		params.put("analysisYear", analysisyear);
		if(!analysisyear.equals(analysisdateTo)){
			params.put("analysisNewTime",dateFrom.substring(0, 4)+"年"+dateFrom.substring(5, 7)+"月至"+dateTo.substring(0, 4)+"年"+dateTo.substring(5, 7)+"月" );
		}else if(analysisyear.equals(analysisdateTo)&&analysismonthfrom.equals("01")&&analysismonthto.equals("12")){
			params.put("analysisNewTime",analysisyear+"年");
		}else if(analysisyear.equals(analysisdateTo)&&analysismonthfrom.equals(analysismonthto)){
			params.put("analysisNewTime",dateFrom.substring(0, 4)+"年"+dateFrom.substring(5, 7)+"月" );
		}else{
			params.put("analysisNewTime",dateFrom.substring(0, 4)+"年"+dateFrom.substring(5, 7)+"月至"+dateTo.substring(5, 7)+"月" );
		}
		
		String hospType=dto.get("hospType")==null?"综合医院":dto.get("hospType").toString().trim();  //医院类型
		//根据医院级别和医院类型选择常规指标及部分描述
		String regularStandardType="regularStandard1";
		if(("三级甲等".equals(hospLevel)||"三级乙等".equals(hospLevel)||"三级".equals(hospLevel))&&"综合医院".equals(hospType)){
			regularStandardType="regularStandard1";
		}else if(("三级甲等".equals(hospLevel)||"三级乙等".equals(hospLevel)||"三级".equals(hospLevel))&&"中医医院".equals(hospType)){
			regularStandardType="regularStandard2";
		}else if(("三级甲等".equals(hospLevel)||"三级乙等".equals(hospLevel)||"三级".equals(hospLevel))&&"专科医院".equals(hospType)){
			regularStandardType="regularStandard3";
		}else if(("二级甲等".equals(hospLevel)||"二级乙等".equals(hospLevel)||"二级".equals(hospLevel))&&"综合医院".equals(hospType)){
			regularStandardType="regularStandard4";
		}else if(("二级甲等".equals(hospLevel)||"二级乙等".equals(hospLevel)||"二级".equals(hospLevel))&&"中医医院".equals(hospType)){
			regularStandardType="regularStandard5";
		}else if(("二级甲等".equals(hospLevel)||"二级乙等".equals(hospLevel)||"二级".equals(hospLevel))&&"专科医院".equals(hospType)){
			regularStandardType="regularStandard6";
		}else if(("一级甲等".equals(hospLevel)||"一级乙等".equals(hospLevel)||"一级".equals(hospLevel))&&"综合医院".equals(hospType)){
			regularStandardType="regularStandard7";
		}else if(("一级甲等".equals(hospLevel)||"一级乙等".equals(hospLevel)||"一级".equals(hospLevel))&&"中医医院".equals(hospType)){
			regularStandardType="regularStandard8";
		}else if(("一级甲等".equals(hospLevel)||"一级乙等".equals(hospLevel)||"一级".equals(hospLevel))&&"专科医院".equals(hospType)){
			regularStandardType="regularStandard9";
		}
		//常规指标总描述
		Properties pro = new Properties();
		propInputStream=AnalysisDRGsReportFacadeImpl.class.getClassLoader().getResourceAsStream("/system.properties");
		try {
			pro.load(new InputStreamReader(propInputStream, "UTF-8"));
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
			errMsg+=e.getMessage();
			allMap.put("errMsg", errMsg);
		}finally {
			if(propInputStream!=null) {
				try {
					propInputStream.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}
		
		// 从配置文件里读取表格中的对比指标
		String regularStandard = pro.getProperty(regularStandardType);// 获取常规指标
		String staffStandard = pro.getProperty("staffStandard");// 获取参评指标
		if (!"".equals(regularStandard) && !"".equals(staffStandard)) {
			String[] regularStandardArray = regularStandard.split(",");
			for (int o = 0; o < regularStandardArray.length; o++) {
				params.put("bgcnt", regularStandardArray[1]==null?"0":Arith.dataFormat(regularStandardArray[1].toString(), "2"));
				params.put("bgfee",  regularStandardArray[2]==null?0:Arith.dataFormat(regularStandardArray[2].toString(), "3"));
				params.put("bgday",  regularStandardArray[3]==null?0:Arith.dataFormat(regularStandardArray[3].toString(), "1"));
				params.put("bgdrug",  regularStandardArray[4]==null?0:Arith.dataFormat(regularStandardArray[4].toString(), "1"));
				params.put("bgdrt",  regularStandardArray[5]==null?0:Arith.dataFormat(regularStandardArray[5].toString(), "1"));
			}

			String[] staffStandardArray = staffStandard.split(",");
			for (int o = 0; o < staffStandardArray.length; o++) {
				params.put("bgincnt",staffStandardArray[0]==null?"0":Arith.dataFormat(staffStandardArray[0].toString(), "2"));
				params.put("bgcmi", staffStandardArray[1]==null?0:Arith.dataFormat(staffStandardArray[1].toString(), "1"));
				params.put("bgdrgcnt",staffStandardArray[2]==null?"0":Arith.dataFormat(staffStandardArray[2].toString(), "2"));
				params.put("bgweight",staffStandardArray[3]==null?"0":Arith.dataFormat(staffStandardArray[3].toString(), "3"));
				params.put("bgtimest", staffStandardArray[5]==null?0:Arith.dataFormat(staffStandardArray[5].toString(), "1"));
				params.put("bgfeest", staffStandardArray[6]==null?0:Arith.dataFormat(staffStandardArray[6].toString(), "1"));
				params.put("bglowrat", staffStandardArray[7]==null?0:Arith.dataFormat(staffStandardArray[7].toString(), "1"));
			}
		}
		
		// 表格一中出院病例数，次均费用，药占比等
		List<Map<String,Object>> hospBaseTable2StOne = analysisDRGsReportApplication.findSimpHospBaseTableOne(paramMap);
		Map<String,Object> hospBaseQuotaSttwoMap=hospBaseTable2StOne.get(0);
		params.put("hospavgfee", hospBaseQuotaSttwoMap.get("HOSPAVGFEE") == null ? 0 : Arith.dataFormat(hospBaseQuotaSttwoMap.get("HOSPAVGFEE").toString(), "3")); 
		params.put("hospavgdays", hospBaseQuotaSttwoMap.get("HOSPAVGDAYS") == null ? 0 : Arith.dataFormat(hospBaseQuotaSttwoMap.get("HOSPAVGDAYS").toString().toString(), "1"));
		params.put("hospdrugratio", hospBaseQuotaSttwoMap.get("HOSPDRUGRATIO") == null ? 0 : Arith.dataFormat(hospBaseQuotaSttwoMap.get("HOSPDRUGRATIO").toString().toString(), "1"));
		params.put("hospdeadratio",hospBaseQuotaSttwoMap.get("HOSPDEADRATIO") == null ? 0 : Arith.dataFormat(hospBaseQuotaSttwoMap.get("HOSPDEADRATIO").toString().toString(), "1"));
	
		// 获取cmi，时间消耗指数，费用消耗指数，drg组数,总权重
		List<Map<String,Object>> hospObjTwo = analysisDRGsReportApplication.findSimpHospBaseTableTwo(paramMap);
		Map<String,Object> hospObjTwoMap=hospObjTwo.get(0);
		params.put("hdcnt", hospObjTwoMap.get("HOSPDRGCNT")==null?0:hospObjTwoMap.get("HOSPDRGCNT"));
		params.put("hcmi", hospObjTwoMap.get("HOSPCMI")==null?0:Arith.dataFormat(hospObjTwoMap.get("HOSPCMI").toString(), "1"));
		params.put("htwt",  hospObjTwoMap.get("HOSPTOTALWEIGHT")==null?0: Arith.dataFormat(hospObjTwoMap.get("HOSPTOTALWEIGHT").toString(), "3")); 
		params.put("hincnt",  hospObjTwoMap.get("HOSPINGROUPCNT")==null?0:hospObjTwoMap.get("HOSPINGROUPCNT"));
		params.put("hefee",  hospObjTwoMap.get("HOSPEFFEE")==null?0:Arith.dataFormat(hospObjTwoMap.get("HOSPEFFEE").toString(), "1"));
		params.put("htfee",  hospObjTwoMap.get("HOSPTIMEFEE")==null?0:Arith.dataFormat(hospObjTwoMap.get("HOSPTIMEFEE").toString(), "1"));
		params.put("driAratio",  hospObjTwoMap.get("DEADRISKARATIO")==null?0:Arith.dataFormat(hospObjTwoMap.get("DEADRISKARATIO").toString(), "1"));
		double bedWeight=0;
		if(hospBedDaysNum.equals("1")){
			params.put("bedWeight", "--");
		}else{
			if(hospBedNum_temp!="0"){
				 bedWeight = Double.valueOf(params.get("hosptotalweight")+"") / (Double.valueOf(hospBedNum_temp));
			}
			params.put("bedWeight", bedWeight);
		}
	}
	
	    //加载第二个章节信息
		public void loadARTwoSection(Map<String, Object> dto, Map<String, Object> paramMap) throws IOException{
			
			// 获取手术病例
			String caseOperCount = analysisDRGsReportApplication.findHospCaseOperationCount(paramMap);
			params.put("caseOperCount_temp", Integer.parseInt(caseOperCount+""));
			params.put("caseOperCount", Arith.dataFormat(caseOperCount+"", "2"));
			String operRation="0";
			if(params.get("hospoutcasecnt_temp")!="0"){
				 operRation = (Arith.mul(Arith.div(Double.valueOf(caseOperCount), Double.valueOf(params.get("hospoutcasecnt_temp") + ""), 4), 100))+"%";
			}else{
				operRation="0";
			}
			//手术占比
			params.put("operRation", operRation);
			
			// 获取手术级别
			List<Map<String,Object>> oplevelList = analysisDRGsReportApplication.findOperCaseByLvel(paramMap);
			String mostlevelname = "--";
			int levOne = 0;
			int levTwo = 0;
			int levThree = 0;
			int levFour = 0;
			int levOther = 0;
			int mostlevelcnt = 0;
			if (oplevelList.size() > 0) {
				for (int i = 0; i < oplevelList.size(); i++) {
					Map<String,Object> obj = oplevelList.get(i);
					String level = obj.get("OPERCASELEVEL") == null ? "--" : (obj.get("OPERCASELEVEL") + "").trim();
					int levelcnt = obj.get("OPERCASECNT") == null ? 0 : Double.valueOf(obj.get("OPERCASECNT") + "").intValue();
					if (i == 0) {
						if (level.equals("1")) {
							levOne = levelcnt;
							mostlevelcnt = levelcnt;
							mostlevelname = "一级";
						} else if (level.equals("2")) {
							levTwo = levelcnt;
							mostlevelcnt = levelcnt;
							mostlevelname = "二级";
						} else if (level.equals("3")) {
							levThree = levelcnt;
							mostlevelcnt = levelcnt;
							mostlevelname = "三级";
						} else if (level.equals("4")) {
							levFour = levelcnt;
							mostlevelcnt = levelcnt;
							mostlevelname = "四级";
						} else {
							levOther = levelcnt;
							mostlevelcnt = levelcnt;
							mostlevelname = "其他";
						}
					} else {
						if (level.equals("1")) {
							levOne = levelcnt;
						} else if (level.equals("2")) {
							levTwo = levelcnt;
						} else if (level.equals("3")) {
							levThree = levelcnt;
						} else if (level.equals("4")) {
							levFour = levelcnt;
						} else {
							levOther = levelcnt;
						}
					}
				}
			}
			
			int levAll=levOne+levTwo+levThree+levFour+levOther;
			params.put("levOne",levOne);
			params.put("levTwo", levTwo);
			params.put("levThree", levThree);
			params.put("levFour", levFour);
			params.put("levOther", levOther);
			
			//将值传回前台展示图片
			allMap.put("levOne",levOne);
			allMap.put("levTwo", levTwo);
			allMap.put("levThree", levThree);
			allMap.put("levFour", levFour);
			allMap.put("levOther", levOther);
			
			params.put("levAll", levAll); //主要手术病例数合计
			//格式化处理数据
			params.put("levOneT",Arith.dataFormat(levOne+"", "2"));
			params.put("levTwoT", Arith.dataFormat(levTwo+"", "2"));
			params.put("levThreeT", Arith.dataFormat(levThree+"", "2"));
			params.put("levFourT", Arith.dataFormat(levFour+"", "2"));
			params.put("levOtherT", Arith.dataFormat(levOther+"", "2"));
			params.put("levAllT", Arith.dataFormat(levAll+"", "2"));
			
			//各级手术比例
			params.put("levOneR",Arith.dataFormat(imputedRatio(Double.valueOf(levOne),Double.valueOf(levAll)).toString(), "1"));
			params.put("levTwoR", Arith.dataFormat(imputedRatio(Double.valueOf(levTwo),Double.valueOf(levAll)).toString(), "1"));
			params.put("levThreeR", Arith.dataFormat(imputedRatio(Double.valueOf(levThree),Double.valueOf(levAll)).toString(), "1"));
			params.put("levFourR", Arith.dataFormat(imputedRatio(Double.valueOf(levFour),Double.valueOf(levAll)).toString(), "1"));
			params.put("levOtherR", Arith.dataFormat(imputedRatio(Double.valueOf(levOther),Double.valueOf(levAll)).toString(), "1"));
			
			//2.2章节 图表2主要手术病例数降序排列前二十位的手术
			List<Map<String,Object>> topTwentyOperList = analysisDRGsReportApplication.findtopTwentyOper(paramMap);
			allMap.put("topTwentyOperList", topTwentyOperList);
			
			//2.3表格各级手术出现次数最多的前五位主要手术名称
			List<Map<String,Object>> mainOperLevelInfoList = analysisDRGsReportApplication.findmainOperLevelInfo(paramMap);
			int totalle1 = 0, totalle2 = 0, totalle3 = 0, totalle4 = 0, totallenull = 0;
			if (mainOperLevelInfoList.size() > 0) {						
				for (int m = 0; m < mainOperLevelInfoList.size(); m++) {
					Map<String,Object> obj = mainOperLevelInfoList.get(m);
					String obj0 = obj.get("EVELEVEL") == null ? "0" : obj.get("EVELEVEL").toString().trim(); //手术级别
					String  obj1= obj.get("EVECNT") == null ? "0" : obj.get("EVECNT").toString().trim(); //手术个数
					if (obj0.equals("1")) {
						totalle1 = totalle1 + Integer.valueOf(obj1);
					} else if (obj0.equals("2")) {
						totalle2 = totalle2 + Integer.valueOf(obj1);
	
					} else if (obj0.equals("3")) {
						totalle3 = totalle3 + Integer.valueOf(obj1);

					} else if (obj0.equals("4")) {
						totalle4 = totalle4 + Integer.valueOf(obj1);

					} else {
						totallenull = totallenull + Integer.valueOf(obj1);
					}
				}
			}
			
			List<Map<String,Object>> toplevelList=new ArrayList<Map<String,Object>>();
			
			
			List<String> topOperARList=new ArrayList<>();
			resultListOne=new ArrayList<List<String>>();
			for (int i = 4; i > 0; i--) {
				int lev=1;
				toplevelList=new ArrayList<Map<String,Object>>();
				toplevelList = analysisDRGsReportApplication.findtopCaseByLevel(paramMap,i);
				if(!toplevelList.isEmpty()){
					for(Map<String,Object> obj :toplevelList){
						if(lev < 6){
						String objCode=obj.get("CODE") == null ? "0" : obj.get("CODE").toString().trim();
						String objDESC=obj.get("DECC") == null ? "0" : obj.get("DECC").toString().trim();
						String objCNT=obj.get("CNT") == null ? "0" : obj.get("CNT").toString().trim();
						topOperARList=new ArrayList<>();
							if(i==4){
								topOperARList.add(lev+"");
								topOperARList.add("四级");
								topOperARList.add(objCode);
								topOperARList.add(objDESC);
								topOperARList.add(objCNT);
								if(totalle4!=0){
									topOperARList.add(Arith.dataFormat(imputedRatio(Double.valueOf(objCNT + ""),Double.valueOf(totalle4)).toString(), "1"));
								}else{
									topOperARList.add("0.00");
								}
							}else if(i==3){
								topOperARList.add(lev+"");
								topOperARList.add("三级");
								topOperARList.add(objCode);
								topOperARList.add(objDESC);
								topOperARList.add(objCNT);
								if(totalle3!=0){
									topOperARList.add(Arith.dataFormat(imputedRatio(Double.valueOf(objCNT + ""),Double.valueOf(totalle3)).toString(), "1"));
								}else{
									topOperARList.add("0.00");
								}
							}else if(i==2){
								topOperARList.add(lev+"");
								topOperARList.add("二级");
								topOperARList.add(objCode);
								topOperARList.add(objDESC);
								topOperARList.add(objCNT);
								if(totalle2!=0){
									topOperARList.add(Arith.dataFormat(imputedRatio(Double.valueOf(objCNT + ""),Double.valueOf(totalle2)).toString(), "1"));
								}else{
									topOperARList.add("0.00");
								}
							}else if(i==1){
								topOperARList.add(lev+"");
								topOperARList.add("一级");
								topOperARList.add(objCode);
								topOperARList.add(objDESC);
								topOperARList.add(objCNT);
								if(totalle1!=0){
									topOperARList.add(Arith.dataFormat(imputedRatio(Double.valueOf(objCNT + ""),Double.valueOf(totalle1)).toString(), "1"));
								}else{
									topOperARList.add("0.00");
								}
							}
							resultListOne.add(topOperARList);
							lev++;
					   }
					}	
				}
			}
			
			//2.4章节 各临床专业主要手术分布
			List<Map<String,Object>> parLevelInfoList = analysisDRGsReportApplication.findParLevelInfoList(paramMap);
			List<String> parLevelARList=new ArrayList<>();
			resultListTwo=new ArrayList<List<String>>(); 
			if(parLevelInfoList.size()>0){
				for(Map<String,Object> obj:parLevelInfoList){
						parLevelARList=new ArrayList<>();
						parLevelARList.add(obj.get("CODE")==null?"--":obj.get("CODE").toString().trim());
						parLevelARList.add(obj.get("ACNT")==null?"0":obj.get("ACNT").toString().trim());
						parLevelARList.add(obj.get("BCNT")==null?"0":obj.get("BCNT").toString().trim());
						parLevelARList.add(obj.get("CCNT")==null?"0":obj.get("CCNT").toString().trim());
						parLevelARList.add(obj.get("DCNT")==null?"0":obj.get("DCNT").toString().trim());
						parLevelARList.add(Arith.dataFormat(obj.get("CDRIO")==null?"0.00":obj.get("CDRIO").toString().trim().toString(), "1"));
						resultListTwo.add(parLevelARList);
				}
			}else{
				parLevelARList=new ArrayList<>();
				parLevelARList.add("-");
				parLevelARList.add("-");
				parLevelARList.add("-");
				parLevelARList.add("-");
				parLevelARList.add("-");
				parLevelARList.add("-");
				resultListTwo.add(parLevelARList);
			}
			
			//2.5章节 图表3十八个重点手术
			List<Map<String,Object>> keyEighteenOperList = analysisDRGsReportApplication.findkeyEighteenOper(paramMap);
			allMap.put("keyEighteenOperList", keyEighteenOperList);
			
		}
		
		//加载第三个章节信息
		public void loadARThreeSection(Map<String, Object> dto, Map<String, Object> paramMap){
			// 获取DRG病组,内科组，外科组，操作组
			int totaldrgCnt =0;
			int outdrgcnt = 0;
			int indrgcnt = 0;
			int operdrgcnt = 0;
			int outcasecnt = 0;
			int incasecnt = 0;
			int opercasecnt = 0;
			Boolean hospDRGsListflag=true;
			List<Map<String,Object>> hospDRGsList = analysisDRGsReportApplication.findHospDRGsInfo(paramMap);
			
				for(Map<String,Object> hospDRGsInfoStep:hospDRGsList){
					while(hospDRGsListflag){
				     totaldrgCnt=Integer.parseInt(hospDRGsInfoStep.get("ALLDRGS")==null?"0":hospDRGsInfoStep.get("ALLDRGS").toString().trim());
					 outdrgcnt = Integer.parseInt(hospDRGsInfoStep.get("WKDRGS")==null?"0":hospDRGsInfoStep.get("WKDRGS").toString().trim());
					 indrgcnt = Integer.parseInt(hospDRGsInfoStep.get("NKDRGS")==null?"0":hospDRGsInfoStep.get("NKDRGS").toString().trim());
					 operdrgcnt = Integer.parseInt(hospDRGsInfoStep.get("CZDRGS")==null?"0":hospDRGsInfoStep.get("CZDRGS").toString().trim());
					 outcasecnt = Integer.parseInt(hospDRGsInfoStep.get("WKCNT")==null?"0":hospDRGsInfoStep.get("WKCNT").toString().trim());
					 incasecnt = Integer.parseInt(hospDRGsInfoStep.get("NKCNT")==null?"0":hospDRGsInfoStep.get("NKCNT").toString().trim());
					 opercasecnt = Integer.parseInt(hospDRGsInfoStep.get("CZCNT")==null?"0":hospDRGsInfoStep.get("CZCNT").toString().trim());
					 hospDRGsListflag=false;
					}
			}
	
			//数据传回前台
		    allMap.put("outdrgc",outdrgcnt);
		    allMap.put("indrgc",indrgcnt);
		    allMap.put("opdrgc",operdrgcnt);
		    allMap.put("outcasec",outcasecnt);
		    allMap.put("incasec",incasecnt);
		    allMap.put("opcasec",opercasecnt);
			
		    params.put("outdrgc",outdrgcnt);
		    params.put("indrgc",indrgcnt);
		    params.put("opdrgc",operdrgcnt);
		    params.put("alldrgc",totaldrgCnt);
		    
			params.put("outdrgcr", Arith.dataFormat(imputedRatio(Double.valueOf(outdrgcnt),Double.valueOf(totaldrgCnt)).toString(), "1"));
			params.put("indrgcr", Arith.dataFormat(imputedRatio(Double.valueOf(indrgcnt),Double.valueOf(totaldrgCnt)).toString(), "1"));
			params.put("opdrgcr", Arith.dataFormat(imputedRatio(Double.valueOf(operdrgcnt),Double.valueOf(totaldrgCnt)).toString(), "1"));
			int ooicasecnt=outcasecnt+incasecnt+opercasecnt;
			params.put("outcasecf", Arith.dataFormat(outcasecnt+"", "2"));
			params.put("outcasecr", Arith.dataFormat(imputedRatio(Double.valueOf(outcasecnt),Double.valueOf(ooicasecnt)).toString(), "1"));
			params.put("incasecf", Arith.dataFormat(incasecnt+"", "2"));
			params.put("incasecr", Arith.dataFormat(imputedRatio(Double.valueOf(incasecnt),Double.valueOf(ooicasecnt)).toString(), "1"));
			params.put("opcasecf", Arith.dataFormat(opercasecnt+"", "2"));
			params.put("opcasecr", Arith.dataFormat(imputedRatio(Double.valueOf(opercasecnt),Double.valueOf(ooicasecnt)).toString(), "1"));
			params.put("allcasecf",ooicasecnt);
			
			//DRG病组和病例复杂程度
			int DRGsType1Num = 0;
			int DRGsType3Num = 0;
			int DRGsType5Num = 0;
			int DRGsType9Num = 0;

			int CaseType1Num = 0;
			int CaseType3Num = 0;
			int CaseType5Num = 0;
			int CaseType9Num = 0;
			Boolean hospDRGsInfoListflag=true;
			List<Map<String,Object>> hospDRGsARList = analysisDRGsReportApplication.findPersonCnt(paramMap);
			
			for(Map<String,Object> map:hospDRGsARList){
				while(hospDRGsInfoListflag){
					DRGsType1Num = Integer.parseInt(map.get("DRGCA")==null?"0":map.get("DRGCA").toString().trim());
					DRGsType3Num = Integer.parseInt(map.get("DRGCB")==null?"0":map.get("DRGCB").toString().trim());
					DRGsType5Num = Integer.parseInt(map.get("DRGCC")==null?"0":map.get("DRGCC").toString().trim());
					CaseType1Num = Integer.parseInt(map.get("CASEA")==null?"0":map.get("CASEA").toString().trim());
					CaseType3Num = Integer.parseInt(map.get("CASEB")==null?"0":map.get("CASEB").toString().trim());
					CaseType5Num = Integer.parseInt(map.get("CASEC")==null?"0":map.get("CASEC").toString().trim());
				    hospDRGsInfoListflag=false;
				}
			}
			
			DRGsType9Num = totaldrgCnt - DRGsType1Num - DRGsType3Num - DRGsType5Num ;
			allMap.put("DRGsType1Num", DRGsType1Num);
			allMap.put("DRGsType3Num", DRGsType3Num);
			allMap.put("DRGsType5Num", DRGsType5Num);
			allMap.put("DRGsType9Num", DRGsType9Num);
      		if (params.get("ingpcacnt") != null) {
				CaseType9Num = Double.valueOf(params.get("ingroupcasecnt_temp") + "").intValue() - CaseType1Num - CaseType3Num - CaseType5Num ;
			} else {
				CaseType9Num = 0;
			}
      		allMap.put("CaseType1Num", CaseType1Num);
      		allMap.put("CaseType3Num", CaseType3Num);
      		allMap.put("CaseType5Num", CaseType5Num);
      		allMap.put("CaseType9Num", CaseType9Num);
      		
      		resultListThree=new ArrayList<List<String>>();
      		
      		drgsCaseARListA=new ArrayList<>();
      		drgsCaseARListA.add("伴重要合并症和伴随病");
      		drgsCaseARListA.add(DRGsType1Num+"");
      		drgsCaseARListA.add(Arith.dataFormat(imputedRatio(Double.valueOf(DRGsType1Num),Double.valueOf(totaldrgCnt)).toString(), "1"));
      		drgsCaseARListA.add(Arith.dataFormat(CaseType1Num+"", "2")); 
      		drgsCaseARListA.add(Arith.dataFormat(imputedRatio(Double.valueOf(CaseType1Num),Double.valueOf(params.get("ingroupcasecnt_temp") + "")).toString(), "1"));
      		resultListThree.add(drgsCaseARListA);
      		
      		drgsCaseARListB=new ArrayList<>();
      		drgsCaseARListB.add("伴一般合并症和伴随病");
      		drgsCaseARListB.add(DRGsType3Num+"");
      		drgsCaseARListB.add(Arith.dataFormat(imputedRatio(Double.valueOf(DRGsType3Num),Double.valueOf(totaldrgCnt)).toString(), "1"));
      		drgsCaseARListB.add(Arith.dataFormat(CaseType3Num+"", "2")); 
      		drgsCaseARListB.add(Arith.dataFormat(imputedRatio(Double.valueOf(CaseType3Num),Double.valueOf(params.get("ingroupcasecnt_temp") + "")).toString(), "1"));
      		resultListThree.add(drgsCaseARListB);
      		
      		drgsCaseARListC=new ArrayList<>();
      		drgsCaseARListC.add("不伴合并症和伴随病");
      		drgsCaseARListC.add(DRGsType5Num+"");
      		drgsCaseARListC.add(Arith.dataFormat(imputedRatio(Double.valueOf(DRGsType5Num),Double.valueOf(totaldrgCnt)).toString(), "1"));
      		drgsCaseARListC.add(Arith.dataFormat(CaseType5Num+"", "2")); 
      		drgsCaseARListC.add(Arith.dataFormat(imputedRatio(Double.valueOf(CaseType5Num),Double.valueOf(params.get("ingroupcasecnt_temp") + "")).toString(), "1"));
      		resultListThree.add(drgsCaseARListC);
      		
      		drgsCaseARListD=new ArrayList<>();
      		drgsCaseARListD.add("其他");
      		drgsCaseARListD.add(DRGsType9Num+"");
      		drgsCaseARListD.add(Arith.dataFormat(imputedRatio(Double.valueOf(DRGsType9Num),Double.valueOf(totaldrgCnt)).toString(), "1"));
      		drgsCaseARListD.add(Arith.dataFormat(CaseType9Num+"", "2")); 
      		drgsCaseARListD.add(Arith.dataFormat(imputedRatio(Double.valueOf(CaseType9Num),Double.valueOf(params.get("ingroupcasecnt_temp") + "")).toString(), "1"));
      		resultListThree.add(drgsCaseARListD);
      		
      		drgsCaseARListE=new ArrayList<>();
      		drgsCaseARListE.add("合计");
      		drgsCaseARListE.add(totaldrgCnt+"");
      		drgsCaseARListE.add("100.00");
      		drgsCaseARListE.add(Arith.dataFormat(params.get("ingroupcasecnt_temp") + "", "2")); 
      		drgsCaseARListE.add("100.00");
      		resultListThree.add(drgsCaseARListE);
      		
			//图表8——不同权重（RW）区间病例数
			//获取重点专业
			List<Map<String,Object>> RWDistribute = analysisDRGsReportApplication.RWDistribute(paramMap,"all");
			List<Map<String, Object>> RWLevelCntList=new ArrayList<>();
			Map<String,Object> RWmap = RWDistribute.get(0);
			String objOnePart=RWmap.get("ONEPART") == null ? "0" : RWmap.get("ONEPART").toString().trim();
			String objTwoPart=RWmap.get("TWOPART") == null ? "0" : RWmap.get("TWOPART").toString().trim();
			String objThreePart=RWmap.get("THREEPART") == null ? "0" : RWmap.get("THREEPART").toString().trim();
			String objFourPart=RWmap.get("FOURPART") == null ? "0" : RWmap.get("FOURPART").toString().trim();
			String objFivePart=RWmap.get("FIVEPART") == null ? "0" : RWmap.get("FIVEPART").toString().trim();
			String objSixPart=RWmap.get("SIXPART") == null ? "0" : RWmap.get("SIXPART").toString().trim();
			Map<String,Object> obj1 = new HashMap<String, Object>();
			obj1.put("RWname","objOnePart");
			obj1.put("RWcnt",objOnePart);
			RWLevelCntList.add(obj1);
			Map<String,Object> obj2 = new HashMap<String, Object>();
			obj2.put("RWname","objTwoPart");
			obj2.put("RWcnt",objTwoPart);
			RWLevelCntList.add(obj2);
			Map<String,Object> obj3 = new HashMap<String, Object>();
			obj3.put("RWname","objThreePart");
			obj3.put("RWcnt",objThreePart);
			RWLevelCntList.add(obj3);
			Map<String,Object> obj4 = new HashMap<String, Object>();
			obj4.put("RWname","objFourPart");
			obj4.put("RWcnt",objFourPart);
			RWLevelCntList.add(obj4);
			Map<String,Object> obj5 = new HashMap<String, Object>();
			obj5.put("RWname","objFivePart");
			obj5.put("RWcnt",objFivePart);
			RWLevelCntList.add(obj5);
			Map<String,Object> obj6 = new HashMap<String, Object>();
			obj6.put("RWname","objSixPart");
			obj6.put("RWcnt",objSixPart);
			RWLevelCntList.add(obj6);
			allMap.put("RWLevelCntList", RWLevelCntList);
			
			//图表9、10——总权重排名前十专科建设的CMI与DRGs组数分布图与DRG病组复杂程度分布图
			List<Map<String,Object>> specDRGsAndCMIList = analysisDRGsReportApplication.findSpecDRGsCntAndCMI(paramMap);
			allMap.put("specDRGsAndCMIList", specDRGsAndCMIList);
      		
			//表格 9  各临床专业不同权重区间病例分布表
      		List<Map<String, Object>> specCodeWeightIntervalList = analysisDRGsReportApplication.findSpecCodeWeightIntervalList(paramMap);
      		//各临床专业
      		List<Map<String, Object>> specDescEveryList = analysisDRGsReportApplication.findSpecDescEveryList(paramMap);
      		List<String> specDescEveryListT=new ArrayList<String>();
      		resultListTwentyTwo=new ArrayList<List<String>>();
      		
      		List<Map<String, Object>> specDescEveryListOne =new ArrayList<Map<String, Object>>();
      		List<String> specDescEveryListOneT=new ArrayList<String>();
      		if(specCodeWeightIntervalList.size()<1){
      			specDescEveryListT=new ArrayList<String>();
      			specDescEveryListT.add("-");
      			specDescEveryListT.add("-");
      			specDescEveryListT.add("-");
      			specDescEveryListT.add("-");
      			specDescEveryListT.add("-");
      			specDescEveryListT.add("-");
      			specDescEveryListT.add("-");
      			specDescEveryListT.add("-");
      			specDescEveryListT.add("-");
      			specDescEveryListT.add("-");
      			specDescEveryListT.add("-");
      			specDescEveryListT.add("-");
      			specDescEveryListT.add("-");
      			resultListTwentyTwo.add(specDescEveryListT);
      		}else{
      			String specDescEveryStr=""; //各临床专业的名称
      			for(Map<String, Object> obj:specDescEveryList){
      				specDescEveryListOne =new ArrayList<Map<String, Object>>();
      				specDescEveryListOneT=new ArrayList<String>();
      				
      				specDescEveryListT=new ArrayList<String>(); //每个元素拼接
          			specDescEveryStr=obj.get("DECC") == null ? "" : obj.get("DECC").toString()+"";
          			specDescEveryListT.add(specDescEveryStr+"");
          			for(Map<String, Object> map:specCodeWeightIntervalList){
          				String specDesc=map.get("SPEC_DESC") == null ? "" : map.get("SPEC_DESC").toString()+"";
          				String specQuJian=map.get("WEIGHT_LEVEL") == null ? "" : map.get("WEIGHT_LEVEL").toString()+"";
          				if(specDescEveryStr.equals(specDesc)){
          					specDescEveryListOne.add(map);
          					specDescEveryListOneT.add(specQuJian);
          				}
          			}
          			
          			if(specDescEveryListOneT.contains("区间1")){
          				for(Map<String, Object> mapB:specCodeWeightIntervalList){
          					String specDesc=mapB.get("SPEC_DESC") == null ? "" : mapB.get("SPEC_DESC").toString()+"";
              				String specQuJian=mapB.get("WEIGHT_LEVEL") == null ? "" : mapB.get("WEIGHT_LEVEL").toString()+"";
              				String DRGSCNT=mapB.get("DRGSCNT") == null ? "" : mapB.get("DRGSCNT").toString()+""; //组数
              				String INCASECNT=mapB.get("INCASECNT") == null ? "" : mapB.get("INCASECNT").toString()+""; //例数
              				String RATE=mapB.get("RATE") == null ? "" : Arith.dataFormat(mapB.get("RATE").toString(),"1"); //例数占比
              				if(("区间1").equals(specQuJian)&&specDescEveryStr.equals(specDesc)){
              					specDescEveryListT.add(INCASECNT+"("+RATE+")");
              					specDescEveryListT.add(DRGSCNT+"");
              				}
              			}
          			}else{
          				specDescEveryListT.add("0(0)");
          				specDescEveryListT.add("0");
          			}
          			
          			if(specDescEveryListOneT.contains("区间2")){
          				for(Map<String, Object> mapB:specCodeWeightIntervalList){
          					String specDesc=mapB.get("SPEC_DESC") == null ? "" : mapB.get("SPEC_DESC").toString()+"";
              				String specQuJian=mapB.get("WEIGHT_LEVEL") == null ? "" : mapB.get("WEIGHT_LEVEL").toString()+"";
              				String DRGSCNT=mapB.get("DRGSCNT") == null ? "" : mapB.get("DRGSCNT").toString()+""; //组数
              				String INCASECNT=mapB.get("INCASECNT") == null ? "" : mapB.get("INCASECNT").toString()+""; //例数
              				String RATE=mapB.get("RATE") == null ? "" : Arith.dataFormat(mapB.get("RATE").toString(),"1"); //例数占比
              				if(("区间2").equals(specQuJian)&&specDescEveryStr.equals(specDesc)){
              					specDescEveryListT.add(INCASECNT+"("+RATE+")");
              					specDescEveryListT.add(DRGSCNT+"");
              				}
              			}
          			}else{
          				specDescEveryListT.add("0(0)");
          				specDescEveryListT.add("0");
          			}
          			
          			if(specDescEveryListOneT.contains("区间3")){
          				for(Map<String, Object> mapB:specCodeWeightIntervalList){
          					String specDesc=mapB.get("SPEC_DESC") == null ? "" : mapB.get("SPEC_DESC").toString()+"";
              				String specQuJian=mapB.get("WEIGHT_LEVEL") == null ? "" : mapB.get("WEIGHT_LEVEL").toString()+"";
              				String DRGSCNT=mapB.get("DRGSCNT") == null ? "" : mapB.get("DRGSCNT").toString()+""; //组数
              				String INCASECNT=mapB.get("INCASECNT") == null ? "" : mapB.get("INCASECNT").toString()+""; //例数
              				String RATE=mapB.get("RATE") == null ? "" : Arith.dataFormat(mapB.get("RATE").toString(),"1"); //例数占比
              				if(("区间3").equals(specQuJian)&&specDescEveryStr.equals(specDesc)){
              					specDescEveryListT.add(INCASECNT+"("+RATE+")");
              					specDescEveryListT.add(DRGSCNT+"");
              				}
              			}
          			}else{
          				specDescEveryListT.add("0(0)");
          				specDescEveryListT.add("0");
          			}
          			
          			if(specDescEveryListOneT.contains("区间4")){
          				for(Map<String, Object> mapB:specCodeWeightIntervalList){
          					String specDesc=mapB.get("SPEC_DESC") == null ? "" : mapB.get("SPEC_DESC").toString()+"";
              				String specQuJian=mapB.get("WEIGHT_LEVEL") == null ? "" : mapB.get("WEIGHT_LEVEL").toString()+"";
              				String DRGSCNT=mapB.get("DRGSCNT") == null ? "" : mapB.get("DRGSCNT").toString()+""; //组数
              				String INCASECNT=mapB.get("INCASECNT") == null ? "" : mapB.get("INCASECNT").toString()+""; //例数
              				String RATE=mapB.get("RATE") == null ? "" : Arith.dataFormat(mapB.get("RATE").toString(),"1"); //例数占比
              				if(("区间4").equals(specQuJian)&&specDescEveryStr.equals(specDesc)){
              					specDescEveryListT.add(INCASECNT+"("+RATE+")");
              					specDescEveryListT.add(DRGSCNT+"");
              				}
              			}
          			}else{
          				specDescEveryListT.add("0(0)");
          				specDescEveryListT.add("0");
          			}
          			
          			if(specDescEveryListOneT.contains("区间5")){
          				for(Map<String, Object> mapB:specCodeWeightIntervalList){
          					String specDesc=mapB.get("SPEC_DESC") == null ? "" : mapB.get("SPEC_DESC").toString()+"";
              				String specQuJian=mapB.get("WEIGHT_LEVEL") == null ? "" : mapB.get("WEIGHT_LEVEL").toString()+"";
              				String DRGSCNT=mapB.get("DRGSCNT") == null ? "" : mapB.get("DRGSCNT").toString()+""; //组数
              				String INCASECNT=mapB.get("INCASECNT") == null ? "" : mapB.get("INCASECNT").toString()+""; //例数
              				String RATE=mapB.get("RATE") == null ? "" : Arith.dataFormat(mapB.get("RATE").toString(),"1"); //例数占比
              				if(("区间5").equals(specQuJian)&&specDescEveryStr.equals(specDesc)){
              					specDescEveryListT.add(INCASECNT+"("+RATE+")");
              					specDescEveryListT.add(DRGSCNT+"");
              				}
              			}
          			}else{
          				specDescEveryListT.add("0(0)");
          				specDescEveryListT.add("0");
          			}
          			
          			if(specDescEveryListOneT.contains("区间6")){
          				for(Map<String, Object> mapB:specCodeWeightIntervalList){
          					String specDesc=mapB.get("SPEC_DESC") == null ? "" : mapB.get("SPEC_DESC").toString()+"";
              				String specQuJian=mapB.get("WEIGHT_LEVEL") == null ? "" : mapB.get("WEIGHT_LEVEL").toString()+"";
              				String DRGSCNT=mapB.get("DRGSCNT") == null ? "" : mapB.get("DRGSCNT").toString()+""; //组数
              				String INCASECNT=mapB.get("INCASECNT") == null ? "" : mapB.get("INCASECNT").toString()+""; //例数
              				String RATE=mapB.get("RATE") == null ? "" : Arith.dataFormat(mapB.get("RATE").toString(),"1"); //例数占比
              				if(("区间6").equals(specQuJian)&&specDescEveryStr.equals(specDesc)){
              					specDescEveryListT.add(INCASECNT+"("+RATE+")");
              					specDescEveryListT.add(DRGSCNT+"");
              				}
              			}
          			}else{
          				specDescEveryListT.add("0(0)");
          				specDescEveryListT.add("0");
          			}
          			resultListTwentyTwo.add(specDescEveryListT);
          		}
      		}
			
      		//图表11——各临床科室费用和时间消耗指数象限分布
      	    // 获取临床专业时间费用消耗指数
			List<Map<String, Object>> efficiencyDepInfoList = analysisDRGsReportApplication.findEfficiencyDepInfoList(paramMap);
			List<Map<String, Object>> depFeeAndTimeEffMapList = new ArrayList<Map<String, Object>>();
		
			//计算各个象限总数
			int   depFeeEffAndTimeEffQuadrantACnt=0;
			int   depFeeEffAndTimeEffQuadrantBCnt=0;
			int   depFeeEffAndTimeEffQuadrantCCnt=0;
			int   depFeeEffAndTimeEffQuadrantDCnt=0;
			List<String> depFeeEffAndTimeEffQuadrantAMap =new ArrayList<>();
			List<String> depFeeEffAndTimeEffQuadrantBMap =new ArrayList<>();
			List<String> depFeeEffAndTimeEffQuadrantCMap =new ArrayList<>();
			List<String> depFeeEffAndTimeEffQuadrantDMap =new ArrayList<>();
			String depFeeEffAndTimeEffQuadrantStr="";
			
			for (Map<String, Object> obj : efficiencyDepInfoList) {
					depFeeEffAndTimeEffQuadrantStr="";
					Double fee = Arith.round(Double.valueOf(String.valueOf(obj.get("FEE") == null ? 0 : obj.get("FEE").toString())),2);
					Double time = Arith.round(Double.valueOf(String.valueOf(obj.get("TIM") == null ? 0 : obj.get("TIM").toString())),2);
					String depName=obj.get("DECC") == null ? "--" : obj.get("DECC")+"";
					depFeeEffAndTimeEffQuadrantStr=depName+"("+time+","+fee+")"; //拼接描述的字符串
					
					Map<String, Object> map = new HashMap<String, Object>();
					map.put("depCode", obj.get("CODE")==null?"--":(obj.get("CODE")+"").trim());
					map.put("depName", depName.trim());
					map.put("feeEff", fee+"");
					map.put("timeEff",time+"");
					depFeeAndTimeEffMapList.add(map);
					//区分四个象限
					if (fee > 1 && time > 1 ) {
						//第一象限
						depFeeEffAndTimeEffQuadrantACnt++;
						depFeeEffAndTimeEffQuadrantAMap.add(depFeeEffAndTimeEffQuadrantStr);
					}  else if (fee >1 && time <= 1) {
						//第二象限
						depFeeEffAndTimeEffQuadrantBCnt++;
						depFeeEffAndTimeEffQuadrantBMap.add(depFeeEffAndTimeEffQuadrantStr);
					} else if(fee <=1 && time <= 1){
						//第三象限
						depFeeEffAndTimeEffQuadrantCCnt++;
						depFeeEffAndTimeEffQuadrantCMap.add(depFeeEffAndTimeEffQuadrantStr);
					} else if(fee <= 1 && time > 1){
						//第四象限
						depFeeEffAndTimeEffQuadrantDCnt++;
						depFeeEffAndTimeEffQuadrantDMap.add(depFeeEffAndTimeEffQuadrantStr);
					}
			}
			allMap.put("depFeeAndTimeEffMapList", depFeeAndTimeEffMapList);
			
			//表格 11  全院各临床专业时间消耗指数和费用消耗指数分布表
			resultListFour=new ArrayList<List<String>>();
			List<String> resultListFourList=new ArrayList<String>();
			String resultListFourStrA="--";
			String resultListFourStrB="--";
			
			//拼接第一象限字符串list
			if(depFeeEffAndTimeEffQuadrantACnt==0){
			}else if(depFeeEffAndTimeEffQuadrantACnt==1){
				resultListFourStrA=depFeeEffAndTimeEffQuadrantAMap.get(0)==null?"":depFeeEffAndTimeEffQuadrantAMap.get(0).toString().trim();
			}else{
				resultListFourStrA=depFeeEffAndTimeEffQuadrantAMap.get(0)==null?"":depFeeEffAndTimeEffQuadrantAMap.get(0).toString().trim();
				resultListFourStrB=depFeeEffAndTimeEffQuadrantAMap.get(1)==null?"":depFeeEffAndTimeEffQuadrantAMap.get(1).toString().trim();
			}
			
			resultListFourList=new ArrayList<String>();
			resultListFourList.add("第一象限（"+depFeeEffAndTimeEffQuadrantACnt+"个专业）");
			resultListFourList.add(resultListFourStrA);
			resultListFour.add(resultListFourList);
			resultListFourList=new ArrayList<String>();
			resultListFourList.add("（时间消耗指数和费用消耗指数均>1）");
			resultListFourList.add(resultListFourStrB);
			resultListFour.add(resultListFourList);
			
			if(depFeeEffAndTimeEffQuadrantACnt>2){
				for (int i = 2; i < depFeeEffAndTimeEffQuadrantACnt; i++) {
					resultListFourList=new ArrayList<String>();
					resultListFourList.add("");
					resultListFourList.add(depFeeEffAndTimeEffQuadrantAMap.get(i)==null?"":depFeeEffAndTimeEffQuadrantAMap.get(i).toString().trim());
					resultListFour.add(resultListFourList);
				}
			}
			
			
			//拼接第二象限字符串list
			resultListFourStrA="--";
			resultListFourStrB="--";
			if(depFeeEffAndTimeEffQuadrantBCnt==0){
			}else if(depFeeEffAndTimeEffQuadrantBCnt==1){
				resultListFourStrA=depFeeEffAndTimeEffQuadrantBMap.get(0)==null?"":depFeeEffAndTimeEffQuadrantBMap.get(0).toString().trim();
			}else{
				resultListFourStrA=depFeeEffAndTimeEffQuadrantBMap.get(0)==null?"":depFeeEffAndTimeEffQuadrantBMap.get(0).toString().trim();
				resultListFourStrB=depFeeEffAndTimeEffQuadrantBMap.get(1)==null?"":depFeeEffAndTimeEffQuadrantBMap.get(1).toString().trim();
			}
			
			resultListFourList=new ArrayList<String>();
			resultListFourList.add("第二象限（"+depFeeEffAndTimeEffQuadrantBCnt+"个专业）");
			resultListFourList.add(resultListFourStrA);
			resultListFour.add(resultListFourList);
			resultListFourList=new ArrayList<String>();
			resultListFourList.add("（时间消耗指数<=1且费用消耗指数>1）");
			resultListFourList.add(resultListFourStrB);
			resultListFour.add(resultListFourList);
			
			if(depFeeEffAndTimeEffQuadrantBCnt>2){
				for (int i = 2; i < depFeeEffAndTimeEffQuadrantBCnt; i++) {
					resultListFourList=new ArrayList<String>();
					resultListFourList.add("");
					resultListFourList.add(depFeeEffAndTimeEffQuadrantBMap.get(i)==null?"":depFeeEffAndTimeEffQuadrantBMap.get(i).toString().trim());
					resultListFour.add(resultListFourList);
				}
			}
			
			//拼接第三象限字符串list
			resultListFourStrA="--";
			resultListFourStrB="--";
			if(depFeeEffAndTimeEffQuadrantCCnt==0){
			}else if(depFeeEffAndTimeEffQuadrantCCnt==1){
				resultListFourStrA=depFeeEffAndTimeEffQuadrantCMap.get(0)==null?"":depFeeEffAndTimeEffQuadrantCMap.get(0).toString().trim();
			}else{
				resultListFourStrA=depFeeEffAndTimeEffQuadrantCMap.get(0)==null?"":depFeeEffAndTimeEffQuadrantCMap.get(0).toString().trim();
				resultListFourStrB=depFeeEffAndTimeEffQuadrantCMap.get(1)==null?"":depFeeEffAndTimeEffQuadrantCMap.get(1).toString().trim();
			}
			
			resultListFourList=new ArrayList<String>();
			resultListFourList.add("第三象限（"+depFeeEffAndTimeEffQuadrantCCnt+"个专业）");
			resultListFourList.add(resultListFourStrA);
			resultListFour.add(resultListFourList);
			resultListFourList=new ArrayList<String>();
			resultListFourList.add("（时间消耗指数和费用消耗指数均<=1）");
			resultListFourList.add(resultListFourStrB);
			resultListFour.add(resultListFourList);
			
			if(depFeeEffAndTimeEffQuadrantCCnt>2){
				for (int i = 2; i < depFeeEffAndTimeEffQuadrantCCnt; i++) {
					resultListFourList=new ArrayList<String>();
					resultListFourList.add("");
					resultListFourList.add(depFeeEffAndTimeEffQuadrantCMap.get(i)==null?"":depFeeEffAndTimeEffQuadrantCMap.get(i).toString().trim());
					resultListFour.add(resultListFourList);
				}
			}
			
			//拼接第四象限字符串list
			resultListFourStrA="--";
			resultListFourStrB="--";
			if(depFeeEffAndTimeEffQuadrantDCnt==0){
			}else if(depFeeEffAndTimeEffQuadrantDCnt==1){
				resultListFourStrA=depFeeEffAndTimeEffQuadrantDMap.get(0)==null?"":depFeeEffAndTimeEffQuadrantDMap.get(0).toString().trim();
			}else{
				resultListFourStrA=depFeeEffAndTimeEffQuadrantDMap.get(0)==null?"":depFeeEffAndTimeEffQuadrantDMap.get(0).toString().trim();
				resultListFourStrB=depFeeEffAndTimeEffQuadrantDMap.get(1)==null?"":depFeeEffAndTimeEffQuadrantDMap.get(1).toString().trim();
			}
			
			resultListFourList=new ArrayList<String>();
			resultListFourList.add("第四象限（"+depFeeEffAndTimeEffQuadrantDCnt+"个专业）");
			resultListFourList.add(resultListFourStrA);
			resultListFour.add(resultListFourList);
			resultListFourList=new ArrayList<String>();
			resultListFourList.add("（时间消耗指数>1且费用消耗指数<=1）");
			resultListFourList.add(resultListFourStrB);
			resultListFour.add(resultListFourList);
			
			if(depFeeEffAndTimeEffQuadrantDCnt>2){
				for (int i = 2; i < depFeeEffAndTimeEffQuadrantDCnt; i++) {
					resultListFourList=new ArrayList<String>();
					resultListFourList.add("");
					resultListFourList.add(depFeeEffAndTimeEffQuadrantDMap.get(i)==null?"":depFeeEffAndTimeEffQuadrantDMap.get(i).toString().trim());
					resultListFour.add(resultListFourList);
				}
			}
			
			//表格 12  全院低风险组死亡病例病组分布表
			List<Map<String, Object>> depDeaRiskAList = analysisDRGsReportApplication.findQualityDepTableByRiskAList(paramMap);
		    int depDeaRiskACnt=0; //全院出现低风险组死亡病例
		    resultListFive=new ArrayList<List<String>>();
		    List<String> depDeadRiskAList=new ArrayList<String>();
		    int depDeadRiskANum=1;
		    if(depDeaRiskAList.size()<1){
		    	depDeadRiskAList=new ArrayList<String>();
		    	depDeadRiskAList.add("-");
		    	depDeadRiskAList.add("-");
		    	depDeadRiskAList.add("-");
		    	depDeadRiskAList.add("-");
		    	depDeadRiskAList.add("-");
		    	depDeadRiskAList.add("-");
		    	depDeadRiskAList.add("-");
		    	resultListFive.add(depDeadRiskAList);
		    }else{
		    	 for(Map<String, Object> obj:depDeaRiskAList){
				    	depDeadRiskAList=new ArrayList<String>();
				    	depDeadRiskAList.add(depDeadRiskANum+"");
				    	depDeadRiskANum++;
				    	depDeadRiskAList.add(obj.get("CODE")==null?"--":obj.get("CODE").toString().trim());
				    	depDeadRiskAList.add(obj.get("DECC")==null?"--":obj.get("DECC").toString().trim());
				    	depDeadRiskAList.add(obj.get("DEP")==null?"--":obj.get("DEP").toString().trim());
				    	depDeadRiskAList.add(obj.get("INC")==null?"0":obj.get("INC").toString().trim());
				    	depDeadRiskAList.add(obj.get("DCN")==null?"0":obj.get("DCN").toString().trim());
				    	depDeaRiskACnt+=Double.valueOf(obj.get("DCN")==null?"0":obj.get("DCN").toString().trim());
				    	depDeadRiskAList.add(obj.get("RAT")==null?"0":Arith.dataFormat(obj.get("RAT").toString().trim(),"1"));
				    	resultListFive.add(depDeadRiskAList);
				    }
		    }
		    
		   
		    params.put("depDeaRiskACnt",depDeaRiskACnt);
		    
			//表格 13  全院中低风险组死亡病例病组分布表
			List<Map<String, Object>> depDeaRiskBList = analysisDRGsReportApplication.findQualityDepTableByRiskBList(paramMap);
		    int depDeaRiskBCnt=0; //全院出现低风险组死亡病例
		    resultListSix=new ArrayList<List<String>>();
		    List<String> depDeadRiskBList=new ArrayList<String>();
		    int depDeadRiskBNum=1;
		    if(depDeaRiskBList.size()<1){
		    	depDeadRiskBList=new ArrayList<String>();
		    	depDeadRiskBList.add("-");
		    	depDeadRiskBList.add("-");
		    	depDeadRiskBList.add("-");
		    	depDeadRiskBList.add("-");
		    	depDeadRiskBList.add("-");
		    	depDeadRiskBList.add("-");
		    	depDeadRiskBList.add("-");
		    	resultListSix.add(depDeadRiskBList);
		    }else{
		    	 for(Map<String, Object> obj:depDeaRiskBList){
				    	depDeadRiskBList=new ArrayList<String>();
				    	depDeadRiskBList.add(depDeadRiskBNum+"");
				    	depDeadRiskBNum++;
				    	depDeadRiskBList.add(obj.get("CODE")==null?"--":obj.get("CODE").toString().trim());
				    	depDeadRiskBList.add(obj.get("DECC")==null?"--":obj.get("DECC").toString().trim());
				    	depDeadRiskBList.add(obj.get("DEP")==null?"--":obj.get("DEP").toString().trim());
				    	depDeadRiskBList.add(obj.get("INC")==null?"0":obj.get("INC").toString().trim());
				    	depDeadRiskBList.add(obj.get("DCN")==null?"0":obj.get("DCN").toString().trim());
				    	depDeaRiskBCnt+=Double.valueOf(obj.get("DCN")==null?"0":obj.get("DCN").toString().trim());
				    	depDeadRiskBList.add(obj.get("RAT")==null?"0":Arith.dataFormat(obj.get("RAT").toString().trim(),"1"));
				    	resultListSix.add(depDeadRiskBList);
				    }
		    }
		    params.put("depDeaRiskBCnt",depDeaRiskBCnt);
		    
		  //表格 14  全院出院病例数最多的二十个病种
		  List<Map<String, Object>> depOutADRGList = analysisDRGsReportApplication.findDepOutADRGList(paramMap);
		  resultListSeven=new ArrayList<List<String>>();
		  List<String> depOutADRGsList =new ArrayList<String>();
		  if(depOutADRGList.size()<1){
			  depOutADRGsList =new ArrayList<String>();
			  depOutADRGsList.add("-");
			  depOutADRGsList.add("-");
			  depOutADRGsList.add("-");
			  depOutADRGsList.add("-");
			  depOutADRGsList.add("-");
			  depOutADRGsList.add("-");
			  depOutADRGsList.add("-");
			  resultListSeven.add(depOutADRGsList);
		  }else{
			  int depOutADRGListNum=1;
			  for(Map<String, Object> obj:depOutADRGList){
				  String adrgscnt=obj.get("CNT")==null?"0":obj.get("CNT").toString().trim();
				  depOutADRGsList =new ArrayList<String>();
				  depOutADRGsList.add(depOutADRGListNum+"");
				  depOutADRGListNum++;
				  depOutADRGsList.add(obj.get("DECC")==null?"--":obj.get("DECC").toString().trim());
				  depOutADRGsList.add(Arith.dataFormat(adrgscnt, "2"));  
				  //病例数占比（%）
				  depOutADRGsList.add(Arith.dataFormat((imputedRatio(Double.valueOf(adrgscnt),Double.valueOf(params.get("hospoutcasecnt_temp").toString().trim()))+""), "1"));
				  depOutADRGsList.add(obj.get("CMI")==null?"0":obj.get("CMI").toString().trim());
				  depOutADRGsList.add(obj.get("DAYS")==null?"0":obj.get("DAYS").toString().trim());
				  depOutADRGsList.add(obj.get("AFEE")==null?"0":obj.get("AFEE").toString().trim());
				  resultListSeven.add(depOutADRGsList);
			  }
		  }
		  
		  //表格 15  全院重点病种医疗服务能力
		  List<Map<String, Object>> depMainADRGList = analysisDRGsReportApplication.findDepMainADRGList(paramMap);
		  resultListEight=new ArrayList<List<String>>();
		  List<String> depMainADRGsList =new ArrayList<String>();
		  if(depOutADRGList.size()<1){
			  depMainADRGsList =new ArrayList<String>();
			  depMainADRGsList.add("-");
			  depMainADRGsList.add("-");
			  depMainADRGsList.add("-");
			  depMainADRGsList.add("-");
			  depMainADRGsList.add("-");
			  depMainADRGsList.add("-");
			  depMainADRGsList.add("-");
			  resultListEight.add(depOutADRGsList);
		  }else{
			  int depOutADRGListNum=1;
			  for(Map<String, Object> obj:depMainADRGList){
				  depMainADRGsList =new ArrayList<String>();
				  depMainADRGsList.add(depOutADRGListNum+"");
				  depOutADRGListNum++;
				  depMainADRGsList.add(obj.get("DECC")==null?"--":obj.get("DECC").toString().trim());
				  depMainADRGsList.add(Arith.dataFormat(obj.get("CNT")==null?"0":obj.get("CNT").toString().trim(), "2"));
				  depMainADRGsList.add(obj.get("RAT")==null?"0":obj.get("RAT").toString().trim());
				  depMainADRGsList.add(obj.get("CMI")==null?"0":obj.get("CMI").toString().trim());
				  depMainADRGsList.add(obj.get("DAYS")==null?"0":obj.get("DAYS").toString().trim());
				  depMainADRGsList.add(obj.get("AFEE")==null?"0":obj.get("AFEE").toString().trim());
				  resultListEight.add(depMainADRGsList);
			  }
		  }
		}
		
		//加载第四个章节信息
		public void loadARFourSection(Map<String, Object> dto, Map<String, Object> paramMap){
			
			//表格 16  一二级手术例数最多的前十名医师列表
			List<Map<String, Object>> docOperAList = analysisDRGsReportApplication.findDocOperAList(paramMap);
			resultListNine=new ArrayList<List<String>>();
			List<String> docOperAListT =new ArrayList<String>();
			  if(docOperAList.size()<1){
				  docOperAListT =new ArrayList<String>();
				  docOperAListT.add("-");
				  docOperAListT.add("-");
				  docOperAListT.add("-");
				  docOperAListT.add("-");
				  docOperAListT.add("-");
				  docOperAListT.add("-");
				  resultListNine.add(docOperAListT);
			  }else{
				  int docOperAListNum=1;
				  for(Map<String, Object> obj:docOperAList){
					  docOperAListT =new ArrayList<String>();
					  docOperAListT.add(docOperAListNum+"");
					  docOperAListNum++;
					  docOperAListT.add(obj.get("DOC")==null?"--":obj.get("DOC").toString().trim());
					  docOperAListT.add(obj.get("DEP")==null?"--":obj.get("DEP").toString().trim());
					  docOperAListT.add(Arith.dataFormat(obj.get("CNT")==null?"0":obj.get("CNT").toString().trim(), "2"));
					  docOperAListT.add(Arith.dataFormat(obj.get("FSCNT")==null?"0":obj.get("FSCNT").toString().trim(), "2"));
					  docOperAListT.add(obj.get("RAT")==null?"0":Arith.dataFormat(obj.get("RAT").toString().trim(), "1"));
					  resultListNine.add(docOperAListT);
				  }
			  }
			
				//表格 17 三四级手术例数最多的前十名医师列表
				List<Map<String, Object>> docOperBList = analysisDRGsReportApplication.findDocOperBList(paramMap);
				resultListTen=new ArrayList<List<String>>();
				List<String> docOperBListT =new ArrayList<String>();
				  if(docOperBList.size()<1){
					  docOperBListT =new ArrayList<String>();
					  docOperBListT.add("-");
					  docOperBListT.add("-");
					  docOperBListT.add("-");
					  docOperBListT.add("-");
					  docOperBListT.add("-");
					  docOperBListT.add("-");
					  resultListTen.add(docOperBListT);
				  }else{
					  int docOperBListNum=1;
					  for(Map<String, Object> obj:docOperBList){
						  docOperBListT =new ArrayList<String>();
						  docOperBListT.add(docOperBListNum+"");
						  docOperBListNum++;
						  docOperBListT.add(obj.get("DOC")==null?"--":obj.get("DOC").toString().trim());
						  docOperBListT.add(obj.get("DEP")==null?"--":obj.get("DEP").toString().trim());
						  docOperBListT.add(Arith.dataFormat(obj.get("CNT")==null?"0":obj.get("CNT").toString().trim(), "2"));
						  docOperBListT.add(Arith.dataFormat(obj.get("FSCNT")==null?"0":obj.get("FSCNT").toString().trim(), "2"));
						  docOperBListT.add(obj.get("RAT")==null?"0":Arith.dataFormat(obj.get("RAT").toString().trim(), "1"));
						  resultListTen.add(docOperBListT);
					  }
				  }
		}
		
		//加载第五个章节信息
		public void loadARFiveSection(Map<String, Object> dto, Map<String, Object> paramMap){
		
			String specDesc=dto.get("specDesc")==null?"--":dto.get("specDesc").toString().trim();
			params.put("specCode", specDesc);
			
			//获取该重点临床专业的各项信息
			List<Map<String, Object>> specCodeInformationList = analysisDRGsReportApplication.findSpecCodeInformationList(paramMap);
			Boolean specCodeFlag=true;
			for(Map<String, Object> obj:specCodeInformationList){
				if(specCodeFlag){
					String cnt=obj.get("CNT")==null?"0":obj.get("CNT").toString().trim();
					params.put("specCodeCnt",Arith.dataFormat(cnt,"2"));
					params.put("specCodeCnt_temp",cnt);
					params.put("specCodeRatio",imputedRatio(Double.valueOf(cnt),Double.valueOf(params.get("hospoutcasecnt_temp").toString().trim()))+"%");
					params.put("specCodeACnt",obj.get("ACNT")==null?"0":obj.get("ACNT").toString().trim());
					params.put("specCodeBCnt",obj.get("BCNT")==null?"0":obj.get("BCNT").toString().trim());
					params.put("specCodeCmi",obj.get("CMI")==null?"0":obj.get("CMI").toString().trim());
					params.put("specDRGRatio",imputedRatio(Double.valueOf(obj.get("BCNT")==null?"0":obj.get("BCNT").toString().trim()),
							 Double.valueOf(obj.get("ACNT")==null?"0":obj.get("ACNT").toString().trim()))+"%");
					params.put("specCodeInCnt",Arith.dataFormat(obj.get("CCNT")==null?"0":obj.get("CCNT").toString().trim(),"2"));
					params.put("specCodeWeight",Arith.dataFormat(obj.get("WEIGHT")==null?"0":obj.get("WEIGHT").toString().trim(),"3"));
					params.put("specCodeTime",obj.get("TIM")==null?"0":obj.get("TIM").toString().trim());
					params.put("specCodeFee",obj.get("FEE")==null?"0":obj.get("FEE").toString().trim());
					params.put("specCodeLowD",obj.get("LOWD")==null?"0":obj.get("LOWD").toString().trim()+"%");
					params.put("specCodeLMD",obj.get("LMD")==null?"0":obj.get("LMD").toString().trim()+"%");
					params.put("specCodeDays",Arith.dataFormat(obj.get("DAYS")==null?"0":obj.get("DAYS").toString().trim(),"1"));
					params.put("specCodeFees",Arith.dataFormat(obj.get("FEES")==null?"0":obj.get("FEES").toString().trim(),"3"));
					params.put("specCodeDrugs",Arith.dataFormat(obj.get("DRUGS")==null?"0":obj.get("DRUGS").toString().trim(),"3"));
					params.put("specCodeDrugsR",obj.get("DRUGAIO")==null?"0":obj.get("DRUGAIO").toString().trim()+"%");
					params.put("specCodeMatre",Arith.dataFormat(obj.get("MATERS")==null?"0":obj.get("MATERS").toString().trim(),"3"));
					params.put("specCodeMatreR",obj.get("MATERAIO")==null?"0":obj.get("MATERAIO").toString().trim()+"%");
					specCodeFlag=false;
				}
			  }	
			
			//5.1 出院病例数分布
			List<Map<String, Object>> specCodeOutCntList = analysisDRGsReportApplication.findSpecCodeOutCntList(paramMap);
			resultListEleven=new ArrayList<List<String>>();
			List<String> specCodeOutCntListT =new ArrayList<String>();
			int specCodeOutCnt=0;
			String specCodeOutRadio="0%";
			if(specCodeOutCntList.size()<1){
				specCodeOutCntListT =new ArrayList<String>();
				specCodeOutCntListT.add("--");
				specCodeOutCntListT.add("--");
				specCodeOutCntListT.add("--");
				specCodeOutCntListT.add("--");
				specCodeOutCntListT.add("--");
				specCodeOutCntListT.add("--");
				resultListEleven.add(specCodeOutCntListT);
			}else{
				int specCodeOutNum=1;
				for(Map<String, Object> obj:specCodeOutCntList){
					String cnt=obj.get("CNT")==null?"0":obj.get("CNT").toString().trim();
					specCodeOutCnt+=Double.valueOf(cnt); //病例数最多的前十位的病组累计出院病例数
					specCodeOutCntListT =new ArrayList<String>();
					specCodeOutCntListT.add(specCodeOutNum+"");
					specCodeOutNum++;
					specCodeOutCntListT.add(obj.get("CODE")==null?"--":obj.get("CODE").toString().trim());
					specCodeOutCntListT.add(obj.get("DECC")==null?"--":obj.get("DECC").toString().trim());
					specCodeOutCntListT.add(Arith.dataFormat(cnt,"2"));
					specCodeOutCntListT.add(imputedRatio(Double.valueOf(cnt),Double.valueOf(params.get("specCodeCnt_temp")+""))+"%");
					specCodeOutCntListT.add(Arith.dataFormat(obj.get("WEIGHT")==null?"0":obj.get("WEIGHT").toString().trim(),"3"));
					resultListEleven.add(specCodeOutCntListT);
				}
				specCodeOutRadio="";
				specCodeOutRadio=imputedRatio(Double.valueOf(specCodeOutCnt),Double.valueOf(params.get("specCodeCnt_temp")+""))+"%";
			}
			params.put("specCodeOutCnt", Arith.dataFormat(specCodeOutCnt+"","2"));
			params.put("specCodeOutRadio", specCodeOutRadio);
			
			//图表12——重点专业不同权重（RW）区间病例数分布图
			List<Map<String,Object>> specRWDistribute = analysisDRGsReportApplication.RWDistribute(paramMap,"one");
			List<Map<String, Object>> specRWLevelCntList=new ArrayList<>();
			String maxCasePart = "";
			Map<String,Object> RWmap = specRWDistribute.get(0);
			String objOnePart=RWmap.get("ONEPART") == null ? "0" : RWmap.get("ONEPART").toString().trim();
			String objTwoPart=RWmap.get("TWOPART") == null ? "0" : RWmap.get("TWOPART").toString().trim();
			String objThreePart=RWmap.get("THREEPART") == null ? "0" : RWmap.get("THREEPART").toString().trim();
			String objFourPart=RWmap.get("FOURPART") == null ? "0" : RWmap.get("FOURPART").toString().trim();
			String objFivePart=RWmap.get("FIVEPART") == null ? "0" : RWmap.get("FIVEPART").toString().trim();
			String objSixPart=RWmap.get("SIXPART") == null ? "0" : RWmap.get("SIXPART").toString().trim();
			String max=RWmap.get("MAX") == null ? "0" : RWmap.get("MAX").toString().trim();
			if(max.equals(objOnePart)){
				maxCasePart="0至0.5";
			}else if (max.equals(objTwoPart)){
				maxCasePart="0.5至0.8";
			}else if (max.equals(objThreePart)){
				maxCasePart="0.8至1.2";
			}else if (max.equals(objFourPart)){
				maxCasePart="1.2至2";
			}else if (max.equals(objFivePart)){
				maxCasePart="2至5";
			}else if (max.equals(objSixPart)){
				maxCasePart="大于5的";
			}
			params.put("maxCasePart", maxCasePart);
			Map<String,Object> obj1 = new HashMap<String, Object>();
			obj1.put("RWname","objOnePart");
			obj1.put("RWcnt",objOnePart);
			specRWLevelCntList.add(obj1);
			Map<String,Object> obj2 = new HashMap<String, Object>();
			obj2.put("RWname","objTwoPart");
			obj2.put("RWcnt",objTwoPart);
			specRWLevelCntList.add(obj2);
			Map<String,Object> obj3 = new HashMap<String, Object>();
			obj3.put("RWname","objThreePart");
			obj3.put("RWcnt",objThreePart);
			specRWLevelCntList.add(obj3);
			Map<String,Object> obj4 = new HashMap<String, Object>();
			obj4.put("RWname","objFourPart");
			obj4.put("RWcnt",objFourPart);
			specRWLevelCntList.add(obj4);
			Map<String,Object> obj5 = new HashMap<String, Object>();
			obj5.put("RWname","objFivePart");
			obj5.put("RWcnt",objFivePart);
			specRWLevelCntList.add(obj5);
			Map<String,Object> obj6 = new HashMap<String, Object>();
			obj6.put("RWname","objSixPart");
			obj6.put("RWcnt",objSixPart);
			specRWLevelCntList.add(obj6);
			allMap.put("specRWLevelCntList", specRWLevelCntList);
			
			//5.2 专业内病例RW分布
			List<Map<String, Object>> specCodeRWDistributeList = analysisDRGsReportApplication.findSpecCodeRWDistributeList(paramMap);
			resultListTwenty=new ArrayList<List<String>>();
			List<String> specCodeRWDistributeListT =new ArrayList<String>();
			if(specCodeRWDistributeList.size()<1){
				specCodeRWDistributeListT =new ArrayList<String>();
				specCodeRWDistributeListT.add("-");
				specCodeRWDistributeListT.add("-");
				specCodeRWDistributeListT.add("-");
				specCodeRWDistributeListT.add("-");
				specCodeRWDistributeListT.add("-");
				specCodeRWDistributeListT.add("-");
				resultListTwenty.add(specCodeRWDistributeListT);
			}else{
				String specCodeRWDistributeListStr="";
				for(Map<String, Object> obj:specCodeRWDistributeList){
					specCodeRWDistributeListT =new ArrayList<String>();
					String str=obj.get("WEIGHT_LEVEL")==null?"":obj.get("WEIGHT_LEVEL").toString().trim();
					if("区间1".equals(str)){
						specCodeRWDistributeListStr="0<RW<=0.5";
					}else if("区间2".equals(str)){
						specCodeRWDistributeListStr="0.5<RW<=0.8";
					}else if("区间3".equals(str)){
						specCodeRWDistributeListStr="0.8<RW<=1.2";
					}else if("区间4".equals(str)){
						specCodeRWDistributeListStr="1.2<RW<=2";
					}else if("区间5".equals(str)){
						specCodeRWDistributeListStr="2<RW<=5";
					}else if("区间6".equals(str)){
						specCodeRWDistributeListStr="RW>5";
					}
					specCodeRWDistributeListT.add(specCodeRWDistributeListStr+"");
					specCodeRWDistributeListT.add(Arith.dataFormat(obj.get("INCASECNT")==null?"0":obj.get("INCASECNT").toString().trim(),"2"));
					specCodeRWDistributeListT.add(Arith.dataFormat(obj.get("RATIO")==null?"0":obj.get("RATIO").toString().trim(),"1"));
					specCodeRWDistributeListT.add(Arith.dataFormat(obj.get("DRGSCNT")==null?"0":obj.get("DRGSCNT").toString().trim(),"2"));
					specCodeRWDistributeListT.add(Arith.dataFormat(obj.get("AVGDAY")==null?"0":obj.get("AVGDAY").toString().trim(),"1"));
					specCodeRWDistributeListT.add(Arith.dataFormat(obj.get("AVGFEE")==null?"0":obj.get("AVGFEE").toString().trim(),"1"));
					resultListTwenty.add(specCodeRWDistributeListT);
				}
				
			}
			
			//5.3效率分析
			List<Map<String, Object>> specCodeEfficiencyList = analysisDRGsReportApplication.findSpecCodeEfficiencyList(paramMap);
			resultListTwelve=new ArrayList<List<String>>();
			List<String> specCodeEfficiencyListT =new ArrayList<String>();
			if(specCodeEfficiencyList.size()<1){
				specCodeEfficiencyListT =new ArrayList<String>();
				specCodeEfficiencyListT.add("--");
				specCodeEfficiencyListT.add("--");
				specCodeEfficiencyListT.add("--");
				specCodeEfficiencyListT.add("--");
				specCodeEfficiencyListT.add("--");
				specCodeEfficiencyListT.add("--");
				specCodeEfficiencyListT.add("--");
				specCodeEfficiencyListT.add("--");
				resultListTwelve.add(specCodeEfficiencyListT);
			}else{
				specCodeEfficiencyListT =new ArrayList<String>();
				int specCodeEfficiencyNum=1;
				for(Map<String, Object> obj:specCodeEfficiencyList){
					String cnt=obj.get("CNT")==null?"0":obj.get("CNT").toString().trim();
					specCodeEfficiencyListT =new ArrayList<String>();
					specCodeEfficiencyListT.add(specCodeEfficiencyNum+"");
					specCodeEfficiencyNum++;
					specCodeEfficiencyListT.add(obj.get("CODE")==null?"--":obj.get("CODE").toString().trim());
					specCodeEfficiencyListT.add(obj.get("DECC")==null?"--":obj.get("DECC").toString().trim());
					specCodeEfficiencyListT.add(Arith.dataFormat(cnt,"2"));
					specCodeEfficiencyListT.add(Arith.dataFormat(obj.get("DAYS")==null?"0":obj.get("DAYS").toString().trim(),"1"));
					specCodeEfficiencyListT.add(Arith.dataFormat(obj.get("ASDAYS")==null?"0":obj.get("ASDAYS").toString().trim(),"1"));
					specCodeEfficiencyListT.add(Arith.dataFormat(obj.get("FEES")==null?"0":obj.get("FEES").toString().trim(),"3"));
					specCodeEfficiencyListT.add(Arith.dataFormat(obj.get("ASFEE")==null?"0":obj.get("ASFEE").toString().trim(),"3"));
					resultListTwelve.add(specCodeEfficiencyListT);
				}
			}
			
			//5.4死亡病例分布
			List<Map<String, Object>> specCodeDeadCntList = analysisDRGsReportApplication.findSpecCodeDeadCntList(paramMap);
			resultListThirteen=new ArrayList<List<String>>();
			List<String> specCodeDeadCntListT =new ArrayList<String>();
			int specCodeDeadCnt=0; //死亡病例总数
			if(specCodeDeadCntList.size()<1){
				specCodeDeadCntListT =new ArrayList<String>();
				specCodeDeadCntListT.add("--");
				specCodeDeadCntListT.add("--");
				specCodeDeadCntListT.add("--");
				specCodeDeadCntListT.add("--");
				specCodeDeadCntListT.add("--");
				specCodeDeadCntListT.add("--");
				specCodeDeadCntListT.add("--");
				resultListThirteen.add(specCodeDeadCntListT);
			}else{
				int specCodeDeadCntListNum=1;
				for(Map<String, Object> obj:specCodeDeadCntList){
						int deadCnt=Double.valueOf(obj.get("DEADCNT")==null?"0":obj.get("DEADCNT").toString().trim()).intValue();
						specCodeDeadCnt+=deadCnt;
						specCodeDeadCntListT =new ArrayList<String>();
						specCodeDeadCntListT.add(specCodeDeadCntListNum+"");
						specCodeDeadCntListNum++;
						specCodeDeadCntListT.add(obj.get("CODE")==null?"--":obj.get("CODE").toString().trim());
						specCodeDeadCntListT.add(obj.get("DECC")==null?"--":obj.get("DECC").toString().trim());
						specCodeDeadCntListT.add(obj.get("LEVDESC")==null?"--":obj.get("LEVDESC").toString().trim());
						specCodeDeadCntListT.add(Arith.dataFormat(obj.get("CNT")==null?"0":obj.get("CNT").toString().trim(),"2"));
						specCodeDeadCntListT.add(Arith.dataFormat(deadCnt+"","2"));
						specCodeDeadCntListT.add(imputedRatio(Double.valueOf(obj.get("DEADCNT")==null?"0":obj.get("DEADCNT").toString().trim()),
								     		Double.valueOf(obj.get("CNT")==null?"0":obj.get("CNT").toString().trim()+""))+"");
						resultListThirteen.add(specCodeDeadCntListT);
				}
			}
			params.put("specCodeDeadCnt", specCodeDeadCnt);
			
			//5.5病组缺失情况
			List<Map<String, Object>> specCodeDRGsLackList = analysisDRGsReportApplication.findSpecCodeDRGsLackList(paramMap);
			resultListFourteen=new ArrayList<List<String>>(); 
			List<String> specCodeDRGsLackListT =new ArrayList<String>();
		    if(specCodeDRGsLackList.size()<1){
		    	specCodeDRGsLackListT =new ArrayList<String>();
		    	specCodeDRGsLackListT.add("--");
		    	specCodeDRGsLackListT.add("--");
		    	specCodeDRGsLackListT.add("--");
		    	specCodeDRGsLackListT.add("--");
		    	resultListFourteen.add(specCodeDRGsLackListT);
		    }else{
		    	int specCodeDRGsLackListN=1;
		    	for(Map<String, Object> obj: specCodeDRGsLackList){
		    		specCodeDRGsLackListT =new ArrayList<String>();
		    		specCodeDRGsLackListT.add(""+specCodeDRGsLackListN);
		    		specCodeDRGsLackListN++;
		    		specCodeDRGsLackListT.add(obj.get("CODE")==null?"--":obj.get("CODE").toString().trim());
		    		specCodeDRGsLackListT.add(obj.get("DECC")==null?"--":obj.get("DECC").toString().trim());
		    		specCodeDRGsLackListT.add(Arith.dataFormat(obj.get("WEIGHT")==null?"0":obj.get("WEIGHT").toString().trim(),"1"));
					resultListFourteen.add(specCodeDRGsLackListT);
		    	}
		    }
		
		    //5.6主要病种分析 
		    List<Map<String, Object>> specCodeMainADRGsList = analysisDRGsReportApplication.findSpecCodeMainADRGsList(paramMap);
		    resultListSixteen=new ArrayList<List<String>>();
		    List<String> specCodeMainADRGsListT =new ArrayList<String>();
		    if(specCodeMainADRGsList.size()<1){
		    	specCodeMainADRGsListT =new ArrayList<String>();
		    	specCodeMainADRGsListT.add("--");
		    	specCodeMainADRGsListT.add("--");
		    	specCodeMainADRGsListT.add("--");
		    	specCodeMainADRGsListT.add("--");
		    	specCodeMainADRGsListT.add("--");
		    	specCodeMainADRGsListT.add("--");
		    	specCodeMainADRGsListT.add("--");
		    	resultListSixteen.add(specCodeMainADRGsListT);
		    }else{
		    	int specCodeMainADRGsListN=1;
		    	for(Map<String, Object> obj:specCodeMainADRGsList){
		    		specCodeMainADRGsListT =new ArrayList<String>();
		    		specCodeMainADRGsListT.add(specCodeMainADRGsListN+"");
		    		specCodeMainADRGsListN++;
		    		specCodeMainADRGsListT.add(obj.get("DECC")==null?"--":obj.get("DECC").toString().trim());
		    		specCodeMainADRGsListT.add(Arith.dataFormat(obj.get("CNT")==null?"0":obj.get("CNT").toString().trim(),"2"));
		    		specCodeMainADRGsListT.add(imputedRatio(Double.valueOf(obj.get("CNT")==null?"0":obj.get("CNT").toString().trim()),
						     				Double.valueOf(params.get("specCodeCnt_temp")+""))+"");
		    		specCodeMainADRGsListT.add(obj.get("CMI")==null?"0":obj.get("CMI").toString().trim());
		    		specCodeMainADRGsListT.add(Arith.dataFormat(obj.get("DAYS")==null?"0":obj.get("DAYS").toString().trim(),"1"));
		    		specCodeMainADRGsListT.add(Arith.dataFormat(obj.get("FEES")==null?"0":obj.get("FEES").toString().trim(),"3"));
		    		resultListSixteen.add(specCodeMainADRGsListT);
		    	}
		    }
		    
			//图表14——重点专业例数最多的十种手术
			List<Map<String,Object>> specTopTenOperList = analysisDRGsReportApplication.findSpecTopTenOper(paramMap);
			allMap.put("specTopTenOperList", specTopTenOperList);
		    
			 //5.7专业手术情况统计
		    //各级手术占比情况
		    List<Map<String, Object>> specCodeOperLevelCntList = analysisDRGsReportApplication.findSpecCodeOperLevelCntList(paramMap);
			int specCodeLevelOne=0;
			int specCodeLevelTwo=0;
			int specCodeLevelThr=0;
			int specCodeLevelFour=0;
			int specCodeLevelOth=0;
			int specCodeLevelAll=0;
			
		    if(specCodeOperLevelCntList.size()<1){
			}else{
				Boolean flagLevel=true;
				for(Map<String, Object> obj:specCodeOperLevelCntList){
					flagLevel=true;
					if(flagLevel){
						String scLevel=obj.get("LEVE")==null?"-":obj.get("LEVE").toString().trim();
						String scCnt=obj.get("CNT")==null?"0":obj.get("CNT").toString().trim();
						if("1".equals(scLevel)){
							specCodeLevelOne=Double.valueOf(scCnt).intValue();
						}else if("2".equals(scLevel)){
							specCodeLevelTwo=Double.valueOf(scCnt).intValue();
						}else if("3".equals(scLevel)){
							specCodeLevelThr=Double.valueOf(scCnt).intValue();
						}else if("4".equals(scLevel)){
							specCodeLevelFour=Double.valueOf(scCnt).intValue();
						}else{
							specCodeLevelOth=Double.valueOf(scCnt).intValue();
						}
						flagLevel=false;
					}
				}
			}
		    //将图12传到前台
		    allMap.put("specCodeLevelOne", specCodeLevelOne);
		    allMap.put("specCodeLevelTwo", specCodeLevelTwo);
		    allMap.put("specCodeLevelThr", specCodeLevelThr);
		    allMap.put("specCodeLevelFour", specCodeLevelFour);
		    allMap.put("specCodeLevelOth", specCodeLevelOth);
		    
		    specCodeLevelAll=specCodeLevelOne+specCodeLevelTwo+specCodeLevelThr+specCodeLevelFour+specCodeLevelOth;
		    //总手术例数及占比
		    params.put("specCodeLevelCnt", Arith.dataFormat(specCodeLevelAll+"","2"));
		    params.put("specCodeLevelRatio", imputedRatio(Double.valueOf(specCodeLevelAll+""),
		    		Double.valueOf(params.get("specCodeCnt_temp").toString().trim()))+"%");
		   //三四级手术例数及占比
		    int specCodeLevelCntA=specCodeLevelThr+specCodeLevelFour;
		    params.put("specCodeLevelCntA", Arith.dataFormat(specCodeLevelCntA+"","2"));
		    params.put("specCodeLevelRatioA", imputedRatio(Double.valueOf(specCodeLevelCntA+""),
		    		Double.valueOf(params.get("specCodeCnt_temp").toString().trim()))+"%");
		    
		    //表格 24 主刀三四级手术例数最多的十名术者
		    List<Map<String, Object>> specCodeOperDocCntList = analysisDRGsReportApplication.findSpecCodeOperDocCntList(paramMap);
		    resultListTwentyOne=new ArrayList<List<String>>(); 
		    List<String> specCodeOperDocCntListT =new ArrayList<String>();
		   if(specCodeOperDocCntList.size()<1){
			   specCodeOperDocCntListT =new ArrayList<String>();
			   specCodeOperDocCntListT.add("-");
			   specCodeOperDocCntListT.add("-");
			   specCodeOperDocCntListT.add("-");
			   specCodeOperDocCntListT.add("-");
			   specCodeOperDocCntListT.add("-");
			   specCodeOperDocCntListT.add("-");
			   specCodeOperDocCntListT.add("-");
			   specCodeOperDocCntListT.add("-");
			   specCodeOperDocCntListT.add("-");
			   resultListTwentyOne.add(specCodeOperDocCntListT);
		   }else{
			   int specCodeOperDocCntListN=1;
			   for(Map<String, Object> obj:specCodeOperDocCntList){
				   if(specCodeOperDocCntListN<11){
					   specCodeOperDocCntListT =new ArrayList<String>();
					   specCodeOperDocCntListT.add(specCodeOperDocCntListN+"");
					   specCodeOperDocCntListN++;
					   specCodeOperDocCntListT.add(obj.get("DOC")==null?"-":obj.get("DOC").toString().trim());
					   specCodeOperDocCntListT.add(Arith.dataFormat(obj.get("CNT")==null?"0":obj.get("CNT").toString().trim(),"2"));
					   specCodeOperDocCntListT.add(Arith.dataFormat(obj.get("ALEVEL")==null?"0":obj.get("ALEVEL").toString().trim(),"2"));
					   specCodeOperDocCntListT.add(Arith.dataFormat(obj.get("BLEVEL")==null?"0":obj.get("BLEVEL").toString().trim(),"2"));
					   specCodeOperDocCntListT.add(Arith.dataFormat(obj.get("CLEVEL")==null?"0":obj.get("CLEVEL").toString().trim(),"2"));
					   specCodeOperDocCntListT.add(Arith.dataFormat(obj.get("DLEVE")==null?"0":obj.get("DLEVE").toString().trim(),"2"));
					   specCodeOperDocCntListT.add(Arith.dataFormat(obj.get("ELEVE")==null?"0":obj.get("ELEVE").toString().trim(),"2"));
					   specCodeOperDocCntListT.add(Arith.dataFormat(obj.get("RATI")==null?"0":obj.get("RATI").toString().trim(),"1"));
					   resultListTwentyOne.add(specCodeOperDocCntListT);
				   }
			   }
		   }
		}
		
		//加载第六个章节信息
		public void loadARSixSection(Map<String, Object> dto, Map<String, Object> paramMap){
			
			//分组器版本描述
			String drgVersionA=paramMap.get("drgVersion")==null?"":paramMap.get("drgVersion")+"";
			String drgVersionInfo= "2016版CN-DRG";
			if(("BJ-V2015.12.29").equals(drgVersionA)){
				 drgVersionInfo= "2015版CN-DRG";
			}else if(("V2014").equals(drgVersionA)){
				 drgVersionInfo= "2014版CN-DRG";
			}else if(("CC-V2015.12.29").equals(drgVersionA)){
				 drgVersionInfo= "2015版CN-DRG";
			}
			params.put("drgVersionInfo", drgVersionInfo);
			
			//未入组病例
			List<Map<String, Object>> noInGroupDataList = analysisDRGsReportApplication.findNoInGroupDataList(paramMap);
			Boolean noInGroupDataBoolean=true;
			for(Map<String, Object> obj:noInGroupDataList){
				if(noInGroupDataBoolean){
					params.put("noInGroupDataAcnt",Arith.dataFormat(obj.get("ACNT")==null?"0":obj.get("ACNT").toString().trim(),"2"));
					params.put("noInGroupDataBcnt",Arith.dataFormat(obj.get("CCNT")==null?"0":obj.get("CCNT").toString().trim(),"2"));
					params.put("noInGroupDataCcnt",Arith.dataFormat(obj.get("BCNT")==null?"0":obj.get("BCNT").toString().trim(),"2"));
					params.put("noInGroupDataDcnt",Arith.dataFormat(obj.get("GROUPRATIO")==null?"0":obj.get("GROUPRATIO").toString().trim(),"1")+"%");
					noInGroupDataBoolean=false;
				}
			}
			
			//表格 25住院天数大于60天病例科室分布表
			List<Map<String, Object>> noInGroupDepOverSixtyList= analysisDRGsReportApplication.findNoInGroupDepOverSixtyList(paramMap);
			resultListSeventeen=new ArrayList<List<String>>();
			List<String> noInGroupDepOverSixtyT =new ArrayList<String>();
			if(noInGroupDepOverSixtyList.size()<1){
				noInGroupDepOverSixtyT =new ArrayList<String>();
				noInGroupDepOverSixtyT.add("-");
				noInGroupDepOverSixtyT.add("-");
				noInGroupDepOverSixtyT.add("-");
				noInGroupDepOverSixtyT.add("-");
				resultListSeventeen.add(noInGroupDepOverSixtyT);
			}else{
				int noInGroupDepOverSixtyListN=1;
				for(Map<String, Object> obj:noInGroupDepOverSixtyList){
					noInGroupDepOverSixtyT =new ArrayList<String>();
					noInGroupDepOverSixtyT.add(noInGroupDepOverSixtyListN+"");
					noInGroupDepOverSixtyListN++;
					noInGroupDepOverSixtyT.add(obj.get("DEP")==null?"-":obj.get("DEP").toString().trim());
					noInGroupDepOverSixtyT.add(Arith.dataFormat(obj.get("CNT")==null?"0":obj.get("CNT").toString().trim(),"2"));
					noInGroupDepOverSixtyT.add(imputedRatio(Double.valueOf(obj.get("CNT")==null?"0":obj.get("CNT").toString().trim()),
				     		Double.valueOf(params.get("oversixtycasecnt_temp")+""))+"");
					resultListSeventeen.add(noInGroupDepOverSixtyT);
				}
			}
			
			//表格 26 未入组病例科室分布表
			List<Map<String, Object>> noInGroupDepList= analysisDRGsReportApplication.findNoInGroupDepList(paramMap);
			resultListEightteen=new ArrayList<List<String>>();
			List<String> noInGroupDepListT =new ArrayList<String>();
			if(noInGroupDepList.size()<1){
				noInGroupDepListT =new ArrayList<String>();
				noInGroupDepListT.add("-");
				noInGroupDepListT.add("-");
				noInGroupDepListT.add("-");
				noInGroupDepListT.add("-");
				resultListEightteen.add(noInGroupDepListT);
			}else{
				int noInGroupDepListTN=1;
				for(Map<String, Object> obj:noInGroupDepList){
					noInGroupDepListT =new ArrayList<String>();
					noInGroupDepListT.add(noInGroupDepListTN+"");
					noInGroupDepListTN++;
					noInGroupDepListT.add(obj.get("DEP")==null?"-":obj.get("DEP").toString().trim());
					noInGroupDepListT.add(Arith.dataFormat(obj.get("CNT")==null?"0":obj.get("CNT").toString().trim(),"2"));
					noInGroupDepListT.add(imputedRatio(Double.valueOf(obj.get("CNT")==null?"0":obj.get("CNT").toString().trim()),
				     		Double.valueOf(params.get("notingrocasecnt_temp")+""))+"");
					resultListEightteen.add(noInGroupDepListT);
				}
			}
			
			//6.2 未入组原因分布
			List<Map<String, Object>> notInGroupReasonList= analysisDRGsReportApplication.findNotInGroupReasonList(paramMap);
			//未入组原因病例传到前台
			allMap.put("notInGroupReasonList",notInGroupReasonList); 
			resultListNineteen=new ArrayList<List<String>>();
			List<String> notInGroupReasonListT =new ArrayList<String>();
			int notInGroupReasonListN=1; //未入组原因总例数
			String notInGroupReasonListStr="--"; //未入组原因拼接字符串
			if(notInGroupReasonList.size()<1){
				notInGroupReasonListT =new ArrayList<String>();
				notInGroupReasonListT.add("-");
				notInGroupReasonListT.add("-");
				notInGroupReasonListT.add("-");
				notInGroupReasonListT.add("-");
				notInGroupReasonListT.add("-");
				resultListNineteen.add(notInGroupReasonListT);
			}else{
				notInGroupReasonListStr="";
				for(Map<String, Object> obj:notInGroupReasonList){
					notInGroupReasonListT =new ArrayList<String>();
					notInGroupReasonListT.add(notInGroupReasonListN+"");
					notInGroupReasonListN++;
					notInGroupReasonListT.add(obj.get("DECC")==null?"-":obj.get("DECC").toString().trim());
					notInGroupReasonListStr+=obj.get("DECC")==null?"-":obj.get("DECC").toString().trim()+"、";
					notInGroupReasonListT.add(Arith.dataFormat(obj.get("CNT")==null?"0":obj.get("CNT").toString().trim(),"2"));
					notInGroupReasonListT.add(imputedRatio(Double.valueOf(obj.get("CNT")==null?"0":obj.get("CNT").toString().trim()),
				     		Double.valueOf(params.get("notingrocasecnt_temp")+""))+"");
					notInGroupReasonListT.add(obj.get("RESUME")==null?"-":obj.get("RESUME").toString().trim());
					resultListNineteen.add(notInGroupReasonListT);
				}
			}
			if(notInGroupReasonListStr.length()>1){
				notInGroupReasonListStr=notInGroupReasonListStr.substring(0, notInGroupReasonListStr.length()-1);
			}
			//6.2未入组原因分布
			params.put("notInGroupReasonListNum", (notInGroupReasonListN-1)+"");
			params.put("notInGroupReasonListStr", notInGroupReasonListStr+"");
			
		}
		
		//加载附表信息
		public void loadARAttachedListSection(Map<String, Object> dto, Map<String, Object> paramMap){
			//附表1:全院及各科室医疗服务综合能力情况表
			List<Map<String, Object>> hospAbilityList = analysisDRGsReportApplication.findHospAbilityList(paramMap);
			resultListFBOne=new ArrayList<List<String>>();
			List<String> hospAbilityListT =new ArrayList<String>();
			if(hospAbilityList.size()<1){
				hospAbilityListT =new ArrayList<String>();
				hospAbilityListT.add("-");
				hospAbilityListT.add("全院");
				hospAbilityListT.add("-");
				hospAbilityListT.add("-");
				hospAbilityListT.add("-");
				hospAbilityListT.add("-");
				hospAbilityListT.add("-");
				hospAbilityListT.add("-");
				hospAbilityListT.add("-");
				hospAbilityListT.add("-");
				resultListFBOne.add(hospAbilityListT);
			}else{
				for(Map<String, Object> obj:hospAbilityList){
					hospAbilityListT =new ArrayList<String>();
					hospAbilityListT.add("-");
					hospAbilityListT.add("全院");
					hospAbilityListT.add(Arith.dataFormat(obj.get("CNT")==null?"0":obj.get("CNT").toString().trim(),"2"));
					hospAbilityListT.add(Arith.dataFormat(obj.get("CMI")==null?"0":obj.get("CMI").toString().trim(),"1"));
					hospAbilityListT.add(obj.get("DRGS")==null?"0":obj.get("DRGS").toString().trim());
					hospAbilityListT.add(Arith.dataFormat(obj.get("WEIGHT")==null?"0":obj.get("WEIGHT").toString().trim(),"3"));
					hospAbilityListT.add(Arith.dataFormat(obj.get("TIME")==null?"0":obj.get("TIME").toString().trim(),"1"));
					hospAbilityListT.add(Arith.dataFormat(obj.get("FEE")==null?"0":obj.get("FEE").toString().trim(),"1"));
					hospAbilityListT.add(Arith.dataFormat(obj.get("ARATIO")==null?"0":obj.get("ARATIO").toString().trim(),"1"));
					hospAbilityListT.add(Arith.dataFormat(obj.get("BRATIO")==null?"0":obj.get("BRATIO").toString().trim(),"1"));
					resultListFBOne.add(hospAbilityListT);
				}
			}
			
			//附表1:各科室医疗服务综合能力情况部分
			List<Map<String, Object>> allDepAbilityList = analysisDRGsReportApplication.findAllDepAbilityList(paramMap);
			if(allDepAbilityList.size()<1){
				hospAbilityListT =new ArrayList<String>();
				hospAbilityListT.add("-");
				hospAbilityListT.add("-");
				hospAbilityListT.add("-");
				hospAbilityListT.add("-");
				hospAbilityListT.add("-");
				hospAbilityListT.add("-");
				hospAbilityListT.add("-");
				hospAbilityListT.add("-");
				hospAbilityListT.add("-");
				hospAbilityListT.add("-");
				resultListFBOne.add(hospAbilityListT);
			}else{
				int allDepAbilityListN=1;
				for(Map<String, Object> obj:allDepAbilityList){
					hospAbilityListT =new ArrayList<String>();
					hospAbilityListT.add(allDepAbilityListN+"");
					allDepAbilityListN++;
					hospAbilityListT.add(obj.get("DECC")==null?"0":obj.get("DECC").toString().trim());
					hospAbilityListT.add(Arith.dataFormat(obj.get("CNT")==null?"0":obj.get("CNT").toString().trim(),"2"));
					hospAbilityListT.add(Arith.dataFormat(obj.get("CMI")==null?"0":obj.get("CMI").toString().trim(),"1"));
					hospAbilityListT.add(obj.get("DRGS")==null?"0":obj.get("DRGS").toString().trim());
					hospAbilityListT.add(Arith.dataFormat(obj.get("WEIGHT")==null?"0":obj.get("WEIGHT").toString().trim(),"3"));
					hospAbilityListT.add(Arith.dataFormat(obj.get("TIME")==null?"0":obj.get("TIME").toString().trim(),"1"));
					hospAbilityListT.add(Arith.dataFormat(obj.get("FEE")==null?"0":obj.get("FEE").toString().trim(),"1"));
					hospAbilityListT.add(Arith.dataFormat(obj.get("ARATIO")==null?"0":obj.get("ARATIO").toString().trim(),"1"));
					hospAbilityListT.add(Arith.dataFormat(obj.get("BRATIO")==null?"0":obj.get("BRATIO").toString().trim(),"1"));
					resultListFBOne.add(hospAbilityListT);
				}
			}
			
			//附表2 全院及各MDC专业DRG病组覆盖情况及医疗服务综合能力情况表
			List<Map<String, Object>> hospallDRGsList = analysisDRGsReportApplication.findHospallDRGsList(paramMap);
		    String hospallDRGsListA="";
		    String hospallDRGsListB="";
		    for(Map<String, Object> obj:hospallDRGsList){
		    	hospallDRGsListA=obj.get("CNT")==null?"0":obj.get("CNT").toString().trim();
			    hospallDRGsListB=obj.get("RADIO")==null?"0":obj.get("RADIO").toString().trim();
		    }
		    
		    resultListFBTwo=new ArrayList<List<String>>();
		    List<String> hospallDRGsListT =new ArrayList<String>();
		    
			if(hospAbilityList.size()<1){
				hospallDRGsListT =new ArrayList<String>();
				hospallDRGsListT.add("-");
				hospallDRGsListT.add("全院");
				hospallDRGsListT.add("-");
				hospallDRGsListT.add("-");
				hospallDRGsListT.add("-");
				hospallDRGsListT.add("-");
				hospallDRGsListT.add("-");
				hospallDRGsListT.add("-");
				hospallDRGsListT.add("-");
				hospallDRGsListT.add("-");
				hospallDRGsListT.add("-");
				hospallDRGsListT.add("-");
				hospallDRGsListT.add("-");
				resultListFBTwo.add(hospallDRGsListT);
			}else{
				for(Map<String, Object> obj:hospAbilityList){
					hospallDRGsListT =new ArrayList<String>();
					hospallDRGsListT.add("-");
					hospallDRGsListT.add("全院");
					hospallDRGsListT.add("-");
					hospallDRGsListT.add(Arith.dataFormat(obj.get("CNT")==null?"0":obj.get("CNT").toString().trim(),"2"));
					hospallDRGsListT.add(hospallDRGsListA);
					hospallDRGsListT.add(hospallDRGsListB);
					hospallDRGsListT.add(Arith.dataFormat(obj.get("CMI")==null?"0":obj.get("CMI").toString().trim(),"1"));
					hospallDRGsListT.add(obj.get("DRGS")==null?"0":obj.get("DRGS").toString().trim());
					hospallDRGsListT.add(Arith.dataFormat(obj.get("WEIGHT")==null?"0":obj.get("WEIGHT").toString().trim(),"3"));
					hospallDRGsListT.add(Arith.dataFormat(obj.get("TIME")==null?"0":obj.get("TIME").toString().trim(),"1"));
					hospallDRGsListT.add(Arith.dataFormat(obj.get("FEE")==null?"0":obj.get("FEE").toString().trim(),"1"));
					hospallDRGsListT.add(Arith.dataFormat(obj.get("ARATIO")==null?"0":obj.get("ARATIO").toString().trim(),"1"));
					hospallDRGsListT.add(Arith.dataFormat(obj.get("BRATIO")==null?"0":obj.get("BRATIO").toString().trim(),"1"));
					resultListFBTwo.add(hospallDRGsListT);
				}
			}
			//附表2 各MDC专业DRG病组覆盖情况及医疗服务综合能力情况
			List<Map<String, Object>> allmdcDRGsList = analysisDRGsReportApplication.findAllmdcDRGsList(paramMap);
			if(allmdcDRGsList.size()<1){
				hospallDRGsListT =new ArrayList<String>();
				hospallDRGsListT.add("-");
				hospallDRGsListT.add("-");
				hospallDRGsListT.add("-");
				hospallDRGsListT.add("-");
				hospallDRGsListT.add("-");
				hospallDRGsListT.add("-");
				hospallDRGsListT.add("-");
				hospallDRGsListT.add("-");
				hospallDRGsListT.add("-");
				hospallDRGsListT.add("-");
				hospallDRGsListT.add("-");
				hospallDRGsListT.add("-");
				hospallDRGsListT.add("-");
				resultListFBTwo.add(hospallDRGsListT);
			}else{
				int allmdcDRGsListN=1;
				for(Map<String, Object> obj:allmdcDRGsList){
					hospallDRGsListT =new ArrayList<String>();
					hospallDRGsListT.add(allmdcDRGsListN+"");
					allmdcDRGsListN++;
					hospallDRGsListT.add(obj.get("CODE")==null?"0":obj.get("CODE").toString().trim());
					hospallDRGsListT.add(obj.get("DECC")==null?"0":obj.get("DECC").toString().trim());
					hospallDRGsListT.add(Arith.dataFormat(obj.get("ACNT")==null?"0":obj.get("ACNT").toString().trim(),"2"));
					hospallDRGsListT.add(Arith.dataFormat(obj.get("BCNT")==null?"0":obj.get("BCNT").toString().trim(),"2"));
					hospallDRGsListT.add(Arith.dataFormat(obj.get("BRATIO")==null?"0":obj.get("BRATIO").toString().trim(),"1"));
					hospallDRGsListT.add(Arith.dataFormat(obj.get("CMI")==null?"0":obj.get("CMI").toString().trim(),"1"));
					hospallDRGsListT.add(obj.get("CCNT")==null?"0":obj.get("CCNT").toString().trim());
					hospallDRGsListT.add(Arith.dataFormat(obj.get("WEIGHT")==null?"0":obj.get("WEIGHT").toString().trim(),"3"));
					hospallDRGsListT.add(Arith.dataFormat(obj.get("TIME")==null?"0":obj.get("TIME").toString().trim(),"1"));
					hospallDRGsListT.add(Arith.dataFormat(obj.get("FEE")==null?"0":obj.get("FEE").toString().trim(),"1"));
					hospallDRGsListT.add(Arith.dataFormat(obj.get("LRT")==null?"0":obj.get("LRT").toString().trim(),"1"));
					hospallDRGsListT.add(Arith.dataFormat(obj.get("MLLRT")==null?"0":obj.get("MLLRT").toString().trim(),"1"));
					resultListFBTwo.add(hospallDRGsListT);
				}
			}
		
			//附表3  住院病例DRG总权重最高的二十位主治医师
			List<Map<String, Object>> docByWeightList = analysisDRGsReportApplication.findDocByWeightList(paramMap);
			resultListFBThree=new ArrayList<List<String>>();
			List<String> docByWeightListT =new ArrayList<String>();
			if(docByWeightList.size()<1){
				docByWeightListT =new ArrayList<String>();
				docByWeightListT.add("-");
				docByWeightListT.add("-");
				docByWeightListT.add("-");
				docByWeightListT.add("-");
				docByWeightListT.add("-");
				docByWeightListT.add("-");
				docByWeightListT.add("-");
				docByWeightListT.add("-");
				docByWeightListT.add("-");
				docByWeightListT.add("-");
				docByWeightListT.add("-");
				resultListFBThree.add(docByWeightListT);
			}else{
				int docByWeightListN=1;
				for(Map<String, Object> obj:docByWeightList){
					if(docByWeightListN<=20){
						docByWeightListT =new ArrayList<String>();
						docByWeightListT.add(docByWeightListN+"");
						docByWeightListN++;
						docByWeightListT.add(obj.get("DECC")==null?"0":obj.get("DECC").toString().trim());
						docByWeightListT.add(obj.get("DEP")==null?"0":obj.get("DEP").toString().trim());
						docByWeightListT.add(Arith.dataFormat(obj.get("CMI")==null?"0":obj.get("CMI").toString().trim(),"1"));
						docByWeightListT.add(obj.get("DCNT")==null?"0":obj.get("DCNT").toString().trim());
						docByWeightListT.add(Arith.dataFormat(obj.get("WEIGHT")==null?"0":obj.get("WEIGHT").toString().trim(),"3"));
						docByWeightListT.add(Arith.dataFormat(obj.get("INCNT")==null?"0":obj.get("INCNT").toString().trim(),"2"));
						docByWeightListT.add(Arith.dataFormat(obj.get("TIME")==null?"0":obj.get("TIME").toString().trim(),"1"));
						docByWeightListT.add(Arith.dataFormat(obj.get("FEE")==null?"0":obj.get("FEE").toString().trim(),"1"));
						docByWeightListT.add(Arith.dataFormat(obj.get("LRATIO")==null?"0":obj.get("LRATIO").toString().trim(),"1"));
						docByWeightListT.add(Arith.dataFormat(obj.get("MRATIO")==null?"0":obj.get("MRATIO").toString().trim(),"1"));
						resultListFBThree.add(docByWeightListT);
					}
				}
			}
			
			//附表4 CMI值最高的二十位主治医师
			List<Map<String, Object>> docByCMIList = analysisDRGsReportApplication.findDocByCMIList(paramMap);
			resultListFBFour=new ArrayList<List<String>>();
			List<String> docByCMIListT =new ArrayList<String>();
			if(docByCMIList.size()<1){
				docByCMIListT =new ArrayList<String>();
				docByCMIListT.add("-");
				docByCMIListT.add("-");
				docByCMIListT.add("-");
				docByCMIListT.add("-");
				docByCMIListT.add("-");
				docByCMIListT.add("-");
				docByCMIListT.add("-");
				docByCMIListT.add("-");
				docByCMIListT.add("-");
				docByCMIListT.add("-");
				docByCMIListT.add("-");
				resultListFBFour.add(docByCMIListT);
			}else{
				int docByCMIListN=1;
				for(Map<String, Object> obj:docByCMIList){
					if(docByCMIListN<=20){
						docByCMIListT =new ArrayList<String>();
						docByCMIListT.add(docByCMIListN+"");
						docByCMIListN++;
						docByCMIListT.add(obj.get("DECC")==null?"0":obj.get("DECC").toString().trim());
						docByCMIListT.add(obj.get("DEP")==null?"0":obj.get("DEP").toString().trim());
						docByCMIListT.add(Arith.dataFormat(obj.get("CMI")==null?"0":obj.get("CMI").toString().trim(),"1"));
						docByCMIListT.add(obj.get("DCNT")==null?"0":obj.get("DCNT").toString().trim());
						docByCMIListT.add(Arith.dataFormat(obj.get("WEIGHT")==null?"0":obj.get("WEIGHT").toString().trim(),"3"));
						docByCMIListT.add(Arith.dataFormat(obj.get("INCNT")==null?"0":obj.get("INCNT").toString().trim(),"2"));
						docByCMIListT.add(Arith.dataFormat(obj.get("TIME")==null?"0":obj.get("TIME").toString().trim(),"1"));
						docByCMIListT.add(Arith.dataFormat(obj.get("FEE")==null?"0":obj.get("FEE").toString().trim(),"1"));
						docByCMIListT.add(Arith.dataFormat(obj.get("LRATIO")==null?"0":obj.get("LRATIO").toString().trim(),"1"));
						docByCMIListT.add(Arith.dataFormat(obj.get("MRATIO")==null?"0":obj.get("MRATIO").toString().trim(),"1"));
						resultListFBFour.add(docByCMIListT);
					}
				}
			}
			//附表5 未入组病例覆盖的所有主要诊断
			List<Map<String, Object>> oldNotInGroupDiagList = analysisDRGsReportApplication.findOldNotInGroupDiagList(paramMap);
			resultListFBFive=new ArrayList<List<String>>();
			List<String> oldNotInGroupDiagListT =new ArrayList<String>();
			if (oldNotInGroupDiagList.size() <1) {
				oldNotInGroupDiagListT =new ArrayList<String>();
				oldNotInGroupDiagListT.add("-");
				oldNotInGroupDiagListT.add("-");
				oldNotInGroupDiagListT.add("-");
				oldNotInGroupDiagListT.add("-");
				oldNotInGroupDiagListT.add("-");
				oldNotInGroupDiagListT.add("-");
				oldNotInGroupDiagListT.add("-");
				oldNotInGroupDiagListT.add("-");
				oldNotInGroupDiagListT.add("-");
				oldNotInGroupDiagListT.add("-");
				resultListFBFive.add(oldNotInGroupDiagListT);
			}else {
				int leftcnt=0;
				//判断是奇数的情况
				if(oldNotInGroupDiagList.size()%2==1){
					 leftcnt=(oldNotInGroupDiagList.size()+1)/2;
				}else{
					//当为偶数的情况
				     leftcnt=oldNotInGroupDiagList.size()/2;
				}
				for (int j = 0; j < leftcnt; j++) {
					//当为奇数最后一位右边设置为空
					if((oldNotInGroupDiagList.size()%2==1)&&(j==leftcnt-1)){
						Map<String, Object> objL=oldNotInGroupDiagList.get(j);
						oldNotInGroupDiagListT =new ArrayList<String>();
						oldNotInGroupDiagListT.add(j+1+"");
						oldNotInGroupDiagListT.add(objL.get("CODE")==null?"-":(objL.get("CODE")+"").trim());
						oldNotInGroupDiagListT.add(objL.get("DECC")==null?"-":(objL.get("DECC")+"").trim());
						oldNotInGroupDiagListT.add(Arith.dataFormat(objL.get("CNT")==null?"0":objL.get("CNT").toString().trim(),"2"));
						oldNotInGroupDiagListT.add(Arith.dataFormat(objL.get("RATIO")==null?"-":(objL.get("RATIO")+"").trim(),"1"));
						oldNotInGroupDiagListT.add("");
						oldNotInGroupDiagListT.add("");
						oldNotInGroupDiagListT.add("");
						oldNotInGroupDiagListT.add("");
						oldNotInGroupDiagListT.add("");
						resultListFBFive.add(oldNotInGroupDiagListT);
					}else{
						Map<String, Object> objL=oldNotInGroupDiagList.get(j);
						Map<String, Object> objR=oldNotInGroupDiagList.get(j+leftcnt);
						oldNotInGroupDiagListT =new ArrayList<String>();
						oldNotInGroupDiagListT.add(j+1+"");
						oldNotInGroupDiagListT.add(objL.get("CODE")==null?"-":(objL.get("CODE")+"").trim());
						oldNotInGroupDiagListT.add(objL.get("DECC")==null?"-":(objL.get("DECC")+"").trim());
						oldNotInGroupDiagListT.add(Arith.dataFormat(objL.get("CNT")==null?"0":objL.get("CNT").toString().trim(),"2"));
						oldNotInGroupDiagListT.add(Arith.dataFormat(objL.get("RATIO")==null?"-":(objL.get("RATIO")+"").trim(),"1"));
						oldNotInGroupDiagListT.add((j+leftcnt+1)+"");
						oldNotInGroupDiagListT.add(objR.get("CODE")==null?"-":(objR.get("CODE")+"").trim());
						oldNotInGroupDiagListT.add(objR.get("DECC")==null?"-":(objR.get("DECC")+"").trim());
						oldNotInGroupDiagListT.add(Arith.dataFormat(objR.get("CNT")==null?"0":objR.get("CNT").toString().trim(),"2"));
						oldNotInGroupDiagListT.add(Arith.dataFormat(objR.get("RATIO")==null?"-":(objR.get("RATIO")+"").trim(),"1"));
						resultListFBFive.add(oldNotInGroupDiagListT);
					}
				}
			}
			
		}
		/**
		 * @methodname :imputedRatio
		 * @Description : 计算百分比
		 * @author:LiuHongjun
		 * @return Double
		 * @date :2016年9月10日
		 */
		public Double imputedRatio(Double a, Double b) {
			return Arith.mul(Arith.div(a, b, 4), 100);
		}
		//生成文档
		@Override
		public Map<String, Object> createDRGsReport() throws IOException {
			
			//1构建手术级别分布
			Map<String,Object> picone = new HashMap<String, Object>();  
			picone.put("width", 220);
			picone.put("height", 200);
			picone.put("type", "jpg");
			picone.put("content", WordUtil.inputStream2ByteArray(new FileInputStream(picRootio+"picone.jpg"), true));  
		    params.put("picone",picone);
		    
			//2构建排名前二十名手术柱形图
			Map<String,Object> pictwo = new HashMap<String, Object>();  
			pictwo.put("width", 520);
			pictwo.put("height", 260);
			pictwo.put("type", "jpg");
			pictwo.put("content", WordUtil.inputStream2ByteArray(new FileInputStream(picRootio+"pictwo.jpg"), true));  
		    params.put("pictwo",pictwo);
		    
		    //3构建十八个重点手术柱形图
		    Map<String,Object> picthree = new HashMap<String, Object>();  
		    picthree.put("width", 520);
		    picthree.put("height", 260);
		    picthree.put("type", "jpg");
		    picthree.put("content", WordUtil.inputStream2ByteArray(new FileInputStream(picRootio+"picthree.jpg"), true));  
		    params.put("picthree",picthree);
		    
		    //4构建DRGs病组类型分布图
		    Map<String,Object> picfour = new HashMap<String, Object>();  
		    picfour.put("width", 220);
		    picfour.put("height", 160);
		    picfour.put("type", "jpg");
		    picfour.put("content", WordUtil.inputStream2ByteArray(new FileInputStream(picRootio+"picfour.jpg"), true));  
		    params.put("picfour",picfour);
		    
		    //5构建DRGs病例类型分布图
		    Map<String,Object> picfive = new HashMap<String, Object>();  
		    picfive.put("width", 220);
		    picfive.put("height", 160);
		    picfive.put("type", "jpg");
		    picfive.put("content", WordUtil.inputStream2ByteArray(new FileInputStream(picRootio+"picfive.jpg"), true));  
		    params.put("picfive",picfive);
		    
		    //6构建DRGs病组复杂程度分布图
		    Map<String,Object> picsix = new HashMap<String, Object>();  
		    picsix.put("width", 220);
		    picsix.put("height", 260);
		    picsix.put("type", "jpg");
		    picsix.put("content", WordUtil.inputStream2ByteArray(new FileInputStream(picRootio+"picsix.jpg"), true));  
		    params.put("picsix",picsix);
		    
		    //7构建DRGs病例复杂程度分布图
		    Map<String,Object> picseven = new HashMap<String, Object>();  
		    picseven.put("width", 220);
		    picseven.put("height", 260);
		    picseven.put("type", "jpg");
		    picseven.put("content", WordUtil.inputStream2ByteArray(new FileInputStream(picRootio+"picseven.jpg"), true));  
		    params.put("picseven",picseven);
		    
			//8构建RW分布面积图
			Map<String,Object> piceight = new HashMap<String, Object>();  
			piceight.put("width", 520);
			piceight.put("height", 260);
			piceight.put("type", "jpg");
			piceight.put("content", WordUtil.inputStream2ByteArray(new FileInputStream(picRootio+"piceight.jpg"), true));  
		    params.put("piceight",piceight);
		    
			//9构建总权重排名前十的临床专业CMI和DRG组数分布图
			Map<String,Object> picnine = new HashMap<String, Object>();  
			picnine.put("width", 520);
			picnine.put("height", 260);
			picnine.put("type", "jpg");
			picnine.put("content", WordUtil.inputStream2ByteArray(new FileInputStream(picRootio+"picnine.jpg"), true));  
		    params.put("picnine",picnine);
		    
			//10构建总权重排名前十的临床专业DRG病组复杂程度分布图
			Map<String,Object> picten = new HashMap<String, Object>();  
			picten.put("width", 520);
			picten.put("height", 260);
			picten.put("type", "jpg");
			picten.put("content", WordUtil.inputStream2ByteArray(new FileInputStream(picRootio+"picten.jpg"), true));  
		    params.put("picten",picten);
		    
			//11构建临床专业时间费用消耗指数分布图
			Map<String,Object> piceleven = new HashMap<String, Object>();  
			piceleven.put("width", 520);
			piceleven.put("height", 260);
			piceleven.put("type", "jpg");
			piceleven.put("content", WordUtil.inputStream2ByteArray(new FileInputStream(picRootio+"piceleven.jpg"), true));  
		    params.put("piceleven",piceleven);
		    
		    //12构建某个重点临床专业RW分布面积图
		    Map<String,Object> pictwelve = new HashMap<String, Object>();  
		    pictwelve.put("width", 520);
		    pictwelve.put("height", 260);
		    pictwelve.put("type", "jpg");
		    pictwelve.put("content", WordUtil.inputStream2ByteArray(new FileInputStream(picRootio+"pictwelve.jpg"), true));  
		    params.put("pictwelve",pictwelve);
		    
		    //13构建某个重点临床专业各手术级别病例分布图
		    Map<String,Object> picthirteen = new HashMap<String, Object>();  
		    picthirteen.put("width", 520);
		    picthirteen.put("height", 260);
		    picthirteen.put("type", "jpg");
		    picthirteen.put("content", WordUtil.inputStream2ByteArray(new FileInputStream(picRootio+"picthirteen.jpg"), true));  
		    params.put("picthirteen",picthirteen);
		    
		    //14构建某个重点临床专业例数最多的十种手术
		    Map<String,Object> picfourteen = new HashMap<String, Object>();  
		    picfourteen.put("width", 520);
		    picfourteen.put("height", 260);
		    picfourteen.put("type", "jpg");
		    picfourteen.put("content", WordUtil.inputStream2ByteArray(new FileInputStream(picRootio+"picfourteen.jpg"), true));  
		    params.put("picfourteen",picfourteen);
		    
		    //15构建DRGs病例未入组原因分布图
		    Map<String,Object> picfifteen = new HashMap<String, Object>();  
		    picfifteen.put("width", 520);
		    picfifteen.put("height", 260);
		    picfifteen.put("type", "jpg");
		    picfifteen.put("content", WordUtil.inputStream2ByteArray(new FileInputStream(picRootio+"picfifteen.jpg"), true));  
		    params.put("picfifteen",picfifteen);
		    
			Map<String,Object> mapAR=new HashMap<String,Object>();
			  try{
				  CustomXWPFDocument doc =new CustomXWPFDocument();
				  String analysisReportRoot="";
				  if("1".equals(specCodeQuFen)&&"综合医院".equals(hospType)){
					  analysisReportRoot="neikeAnalysisReport.docx"; //综合医院内科，不包含5.7章节
				  }else if("2".equals(specCodeQuFen)&&"综合医院".equals(hospType)){
					  analysisReportRoot="analysisReport.docx"; //综合医院外科，包含5.7章节
				  }else if("1".equals(specCodeQuFen)&&"中医医院".equals(hospType)){
					  analysisReportRoot="neikeSpecialAnalysisReport.docx"; //中医医院内科，不包含2.5,3.3,5.7章节
				  }else if("1".equals(specCodeQuFen)&&"专科医院".equals(hospType)){
					  analysisReportRoot="neikeSpecialAnalysisReport.docx"; //专科医院内科，不包含2.5,3.3,5.7章节
				  }else{
					  analysisReportRoot="specialAnalysisReport.docx"; //中医、专科医院外科，不包含2.5,3.3章节
				  }
				  doc = WordUtil.generateWord(params, wordRootio+analysisReportRoot);
				  WordUtil.insertValueToTable(doc, resultListOne, 2, true);
				  WordUtil.insertValueToTable(doc, resultListTwo, 4, true);
				  WordUtil.insertValueToTable(doc, resultListThree, 6, true);
				  WordUtil.insertValueToTable(doc, resultListFour, 7, true);
				  WordUtil.insertValueToTable(doc, resultListFive, 8, true);
				  WordUtil.insertValueToTable(doc, resultListSix, 9, true);
				  WordUtil.insertValueToTable(doc, resultListSeven, 10, true);
				  WordUtil.insertValueToTable(doc, resultListEight, 11, true);
				  WordUtil.insertValueToTable(doc, resultListNine, 12, true);
				  WordUtil.insertValueToTable(doc, resultListTen, 13, true);
				  WordUtil.insertValueToTable(doc, resultListEleven, 14, true);
				  WordUtil.insertValueToTable(doc, resultListTwelve, 15, true);
				  WordUtil.insertValueToTable(doc, resultListThirteen, 16, true);
				  WordUtil.insertValueToTable(doc, resultListFourteen, 17, true);
				  WordUtil.insertValueToTable(doc, resultListSixteen, 30, true);
				  WordUtil.insertValueToTable(doc, resultListSeventeen, 24, true); //表格25
				  WordUtil.insertValueToTable(doc, resultListEightteen, 25, true); //表格26
				  WordUtil.insertValueToTable(doc, resultListNineteen, 26, true); //表格27
				  WordUtil.insertValueToTable(doc, resultListTwenty, 27, true); //表格19
				  WordUtil.insertValueToTable(doc, resultListTwentyOne, 28, true); 
				  WordUtil.insertValueToTable(doc, resultListTwentyTwo, 29, true); //表格9
				  WordUtil.insertValueToTable(doc, resultListFBOne, 19, true);  //附表1
				  WordUtil.insertValueToTable(doc, resultListFBTwo, 20, true);  //附表2
				  WordUtil.insertValueToTable(doc, resultListFBThree, 21, true);//附表3
				  WordUtil.insertValueToTable(doc, resultListFBFour, 22, true); //附表4
				  WordUtil.insertValueToTable(doc, resultListFBFive, 23, true); //附表5
				  
				  reportNo = System.currentTimeMillis(); //生成文档结束时间
				  File folder = new File(writeRootio);
				  if (!folder.exists()) {
						folder.mkdirs();
					}
				 String outputFile = folder.getPath() + File.separator + reportNo + ".docx";
				 FileOutputStream fopts = new FileOutputStream(outputFile);
				 doc.write(fopts);
				 fopts.close();
				 System.err.println(" \n 文档生成成功 path=\n" + outputFile);
				 System.err.println("生成文档耗时time=" + (System.currentTimeMillis() - start) / 1000);
				 mapAR.put("patch", "tmp/"+reportNo+".docx");
				 mapAR.put("hospname", params.get("hospName")+"");
				 return mapAR;
              } catch (Exception e) {
				  e.printStackTrace();
			  }
			  return mapAR;
		}
		/**
		 * 
		* @ClassName: TestRunnable 
		* @Description: 线程 第一章节
		* @author shaozhiyuan
		* @date 2017年11月29日 下午3:43:02 
		*
		 */
	private	class TestRunnableA implements Runnable { 
			private Map<String, Object> dto=new HashMap<String, Object>();
			private Map<String, Object> map=new HashMap<String, Object>();
			TestRunnableA(Map<String, Object> dto,Map<String, Object> map){
				this.dto=dto;
				this.map=map;
			}
		    public void run() { 
		                    try {
		                    	    loadARFirstSection(dto, map);   
		                    } catch (Exception e) { 
		                            e.printStackTrace(); 
		                    } 
		      }
		}
	/**
	 * 
	* @ClassName: TestRunnable 
	* @Description: 线程 第二章节
	* @author shaozhiyuan
	* @date 2017年11月29日 下午3:43:02 
	*
	 */
   private	class TestRunnableB implements Runnable { 
		private Map<String, Object> dto=new HashMap<String, Object>();
		private Map<String, Object> map=new HashMap<String, Object>();
		TestRunnableB(Map<String, Object> dto,Map<String, Object> map){
			this.dto=dto;
			this.map=map;
		}
	    public void run() { 
	                    try {
	                    		loadARTwoSection(dto, map);  
	                    } catch (Exception e) { 
	                            e.printStackTrace(); 
	                    } 
	      }
	 }
	/**
	 * 
	* @ClassName: TestRunnable 
	* @Description: 线程 第三章节
	* @author shaozhiyuan
	* @date 2017年11月29日 下午3:43:02 
	*
	 */
  private	class TestRunnableC implements Runnable { 
		private Map<String, Object> dto=new HashMap<String, Object>();
		private Map<String, Object> map=new HashMap<String, Object>();
		TestRunnableC(Map<String, Object> dto,Map<String, Object> map){
			this.dto=dto;
			this.map=map;
		}
	    public void run() { 
	                    try {
	                    		loadARThreeSection(dto, map);   
	                    } catch (Exception e) { 
	                            e.printStackTrace(); 
	                    } 
	      }
	 }
	/**
	 * 
	* @ClassName: TestRunnable 
	* @Description: 线程 第四章节
	* @author shaozhiyuan
	* @date 2017年11月29日 下午3:43:02 
	*
	 */
 private	class TestRunnableD implements Runnable { 
		private Map<String, Object> dto=new HashMap<String, Object>();
		private Map<String, Object> map=new HashMap<String, Object>();
		TestRunnableD(Map<String, Object> dto,Map<String, Object> map){
			this.dto=dto;
			this.map=map;
		}
	    public void run() { 
	                    try {
	                    		loadARFourSection(dto, map);   
	                    } catch (Exception e) { 
	                            e.printStackTrace(); 
	                    } 
	      }
	 }
	/**
	 * 
	* @ClassName: TestRunnable 
	* @Description: 线程 第五章节
	* @author shaozhiyuan
	* @date 2017年11月29日 下午3:43:02 
	*
	 */
private	class TestRunnableE implements Runnable { 
		private Map<String, Object> dto=new HashMap<String, Object>();
		private Map<String, Object> map=new HashMap<String, Object>();
		TestRunnableE(Map<String, Object> dto,Map<String, Object> map){
			this.dto=dto;
			this.map=map;
		}
	    public void run() { 
	                    try {
	                    		loadARFiveSection(dto, map);   
	                    } catch (Exception e) { 
	                            e.printStackTrace(); 
	                    } 
	      }
	 }
/**
 * 
* @ClassName: TestRunnable 
* @Description: 线程 第六章节
* @author shaozhiyuan
* @date 2017年11月29日 下午3:43:02 
*
 */
private	class TestRunnableF implements Runnable { 
	private Map<String, Object> dto=new HashMap<String, Object>();
	private Map<String, Object> map=new HashMap<String, Object>();
	TestRunnableF(Map<String, Object> dto,Map<String, Object> map){
		this.dto=dto;
		this.map=map;
	}
    public void run() { 
                    try {
                    		loadARSixSection(dto, map);   
                    } catch (Exception e) { 
                            e.printStackTrace(); 
                    } 
      }
 }
/**
 * 
* @ClassName: TestRunnable 
* @Description: 线程  附表章节
* @author shaozhiyuan
* @date 2017年11月29日 下午3:43:02 
*
 */
private	class TestRunnableG implements Runnable { 
	private Map<String, Object> dto=new HashMap<String, Object>();
	private Map<String, Object> map=new HashMap<String, Object>();
	TestRunnableG(Map<String, Object> dto,Map<String, Object> map){
		this.dto=dto;
		this.map=map;
	}
    public void run() {
                    try {
                    		loadARAttachedListSection(dto, map);   
                    } catch (Exception e) { 
                            e.printStackTrace(); 
                    } 
         }
   }


}

